use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser in project kripton by xcesco.
the class ByteBeanTable method parseValue2.
/**
* for attribute value2 parsing
*/
public static Byte[] 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();
Byte[] result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Byte> collection = new ArrayList<>();
Byte item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = jacksonParser.getByteValue();
}
collection.add(item);
}
result = CollectionUtils.asByteArray(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 ByteDaoImpl method parser1.
/**
* for param parser1 parsing
*/
private Byte[] 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();
Byte[] result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Byte> collection = new ArrayList<>();
Byte item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = jacksonParser.getByteValue();
}
collection.add(item);
}
result = CollectionUtils.asByteArray(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 CharBeanTable method parseValue.
/**
* for attribute value parsing
*/
public static char[] 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();
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 CharBeanTable method parseValue2.
/**
* for attribute value2 parsing
*/
public static Character[] 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();
Character[] 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.asCharacterArray(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 parser5.
/**
* for param parser5 parsing
*/
private Set<String> parser5(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();
Set<String> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
HashSet<String> collection = new HashSet<>();
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()));
}
}
Aggregations