use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project kripton by xcesco.
the class Bean84ABindMap method parseOnJacksonAsString.
/**
* parse with jackson
*/
@Override
public Bean84A parseOnJacksonAsString(JsonParser jacksonParser) throws Exception {
Bean84A instance = new Bean84A();
String fieldName;
if (jacksonParser.getCurrentToken() == null) {
jacksonParser.nextToken();
}
if (jacksonParser.getCurrentToken() != JsonToken.START_OBJECT) {
jacksonParser.skipChildren();
return instance;
}
while (jacksonParser.nextToken() != JsonToken.END_OBJECT) {
fieldName = jacksonParser.getCurrentName();
jacksonParser.nextToken();
// Parse fields:
switch(fieldName) {
case "columnArrayByteType":
// field columnArrayByteType (mapped with "columnArrayByteType")
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
instance.columnArrayByteType = Base64Utils.decode(jacksonParser.getValueAsString());
}
break;
case "columnArrayChar":
// field columnArrayChar (mapped with "columnArrayChar")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Character> collection = new ArrayList<>();
Character item = null;
String tempValue = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
tempValue = jacksonParser.getValueAsString();
if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && "null".equals(tempValue)) {
item = null;
} else {
item = PrimitiveUtils.readCharacter(jacksonParser.getText(), null);
}
collection.add(item);
}
instance.columnArrayChar = CollectionUtils.asCharacterArray(collection);
} else if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && !StringUtils.hasText(jacksonParser.getValueAsString())) {
ArrayList<Character> collection = new ArrayList<>();
instance.columnArrayChar = CollectionUtils.asCharacterArray(collection);
}
break;
case "columnArrayCharType":
// field columnArrayCharType (mapped with "columnArrayCharType")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Character> collection = new ArrayList<>();
Character item = null;
String tempValue = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
tempValue = jacksonParser.getValueAsString();
if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && "null".equals(tempValue)) {
item = null;
} else {
item = PrimitiveUtils.readCharacter(jacksonParser.getText(), '