use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project kripton by xcesco.
the class Bean01Table method parseTemp.
/**
* for attribute temp parsing
*/
public static List<String> parseTemp(byte[] input) {
if (input == null) {
return null;
}
KriptonJsonContext context = KriptonBinder.jsonBind();
try (JacksonWrapperParser wrapper = context.createParser(input)) {
JsonParser jacksonParser = wrapper.jacksonParser;
// START_OBJECT
jacksonParser.nextToken();
// value of "element"
jacksonParser.nextValue();
List<String> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<String> collection = new ArrayList<>();
String item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = jacksonParser.getText();
}
collection.add(item);
}
result = collection;
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project kripton by xcesco.
the class BeanDaoImpl method parser1.
/**
* for param parser1 parsing
*/
private BeanInner[] parser1(byte[] input) {
if (input == null) {
return null;
}
KriptonJsonContext context = KriptonBinder.jsonBind();
try (JacksonWrapperParser wrapper = context.createParser(input)) {
JsonParser jacksonParser = wrapper.jacksonParser;
// START_OBJECT
jacksonParser.nextToken();
// value of "element"
jacksonParser.nextValue();
BeanInner[] result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<BeanInner> collection = new ArrayList<>();
BeanInner item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = beanInnerBindMap.parseOnJackson(jacksonParser);
}
collection.add(item);
}
result = CollectionUtils.asArray(collection, new BeanInner[collection.size()]);
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project kripton by xcesco.
the class CharDaoImpl method parser1.
/**
* for param parser1 parsing
*/
private char[] parser1(byte[] input) {
if (input == null) {
return null;
}
KriptonJsonContext context = KriptonBinder.jsonBind();
try (JacksonWrapperParser wrapper = context.createParser(input)) {
JsonParser jacksonParser = wrapper.jacksonParser;
// START_OBJECT
jacksonParser.nextToken();
// value of "element"
jacksonParser.nextValue();
char[] result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Character> collection = new ArrayList<>();
Character item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = Character.valueOf((char) jacksonParser.getIntValue());
}
collection.add(item);
}
result = CollectionUtils.asCharacterTypeArray(collection);
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project kripton by xcesco.
the class DoubleBeanTable method parseValue.
/**
* for attribute value parsing
*/
public static double[] parseValue(byte[] input) {
if (input == null) {
return null;
}
KriptonJsonContext context = KriptonBinder.jsonBind();
try (JacksonWrapperParser wrapper = context.createParser(input)) {
JsonParser jacksonParser = wrapper.jacksonParser;
// START_OBJECT
jacksonParser.nextToken();
// value of "element"
jacksonParser.nextValue();
double[] result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Double> collection = new ArrayList<>();
Double item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = jacksonParser.getDoubleValue();
}
collection.add(item);
}
result = CollectionUtils.asDoubleTypeArray(collection);
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project kripton by xcesco.
the class DoubleBeanTable method parseValue2.
/**
* for attribute value2 parsing
*/
public static Double[] parseValue2(byte[] input) {
if (input == null) {
return null;
}
KriptonJsonContext context = KriptonBinder.jsonBind();
try (JacksonWrapperParser wrapper = context.createParser(input)) {
JsonParser jacksonParser = wrapper.jacksonParser;
// START_OBJECT
jacksonParser.nextToken();
// value of "element"
jacksonParser.nextValue();
Double[] result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Double> collection = new ArrayList<>();
Double item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = jacksonParser.getDoubleValue();
}
collection.add(item);
}
result = CollectionUtils.asDoubleArray(collection);
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
Aggregations