use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project kripton by xcesco.
the class Bean81RBindMap method parseOnJacksonAsString.
/**
* parse with jackson
*/
@Override
public Bean81R parseOnJacksonAsString(JsonParser jacksonParser) throws Exception {
Bean81R instance = new Bean81R();
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 "valueByteArray":
// field valueByteArray (mapped with "valueByteArray")
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
instance.valueByteArray = Base64Utils.decode(jacksonParser.getValueAsString());
}
break;
case "id":
// field id (mapped with "id")
instance.id = PrimitiveUtils.readLong(jacksonParser.getText(), 0L);
break;
case "valueMapStringInteger":
// field valueMapStringInteger (mapped with "valueMapStringInteger")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
HashMap<String, Integer> collection = new HashMap<>();
String key = null;
Integer value = null;
JsonToken current;
String tempValue = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
current = jacksonParser.currentToken();
for (int i = 0; i < 2; i++) {
while (current != JsonToken.FIELD_NAME) {
current = jacksonParser.nextToken();
}
jacksonParser.nextValue();
switch(jacksonParser.getCurrentName()) {
case "key":
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
key = jacksonParser.getText();
}
break;
case "value":
tempValue = jacksonParser.getValueAsString();
if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && "null".equals(tempValue)) {
value = null;
} else {
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
value = PrimitiveUtils.readInteger(jacksonParser.getText(), null);
}
}
break;
}
}
collection.put(key, value);
key = null;
value = null;
jacksonParser.nextToken();
}
instance.valueMapStringInteger = collection;
}
break;
case "valueInteger":
// field valueInteger (mapped with "valueInteger")
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
instance.valueInteger = PrimitiveUtils.readInteger(jacksonParser.getText(), null);
}
break;
default:
jacksonParser.skipChildren();
break;
}
}
return instance;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project kripton by xcesco.
the class Bean81SBindMap method parseOnJacksonAsString.
/**
* parse with jackson
*/
@Override
public Bean81S parseOnJacksonAsString(JsonParser jacksonParser) throws Exception {
Bean81S instance = new Bean81S();
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 "id":
// field id (mapped with "id")
instance.id = PrimitiveUtils.readLong(jacksonParser.getText(), 0L);
break;
case "valueByteArray":
// field valueByteArray (mapped with "valueByteArray")
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
instance.valueByteArray = Base64Utils.decode(jacksonParser.getValueAsString());
}
break;
case "valueMapStringInteger":
// field valueMapStringInteger (mapped with "valueMapStringInteger")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
HashMap<String, Integer> collection = new HashMap<>();
String key = null;
Integer value = null;
JsonToken current;
String tempValue = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
current = jacksonParser.currentToken();
for (int i = 0; i < 2; i++) {
while (current != JsonToken.FIELD_NAME) {
current = jacksonParser.nextToken();
}
jacksonParser.nextValue();
switch(jacksonParser.getCurrentName()) {
case "key":
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
key = jacksonParser.getText();
}
break;
case "value":
tempValue = jacksonParser.getValueAsString();
if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && "null".equals(tempValue)) {
value = null;
} else {
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
value = PrimitiveUtils.readInteger(jacksonParser.getText(), null);
}
}
break;
}
}
collection.put(key, value);
key = null;
value = null;
jacksonParser.nextToken();
}
instance.valueMapStringInteger = collection;
}
break;
case "valueInteger":
// field valueInteger (mapped with "valueInteger")
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
instance.valueInteger = PrimitiveUtils.readInteger(jacksonParser.getText(), null);
}
break;
default:
jacksonParser.skipChildren();
break;
}
}
return instance;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project kripton by xcesco.
the class Bean81VBindMap method parseOnJacksonAsString.
/**
* parse with jackson
*/
@Override
public Bean81V parseOnJacksonAsString(JsonParser jacksonParser) throws Exception {
Bean81V instance = new Bean81V();
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 "id":
// field id (mapped with "id")
instance.id = PrimitiveUtils.readLong(jacksonParser.getText(), 0L);
break;
case "array":
// field valueByteArray (mapped with "array")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Byte> collection = new ArrayList<>();
Byte 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.readByte(jacksonParser.getText(), null);
}
collection.add(item);
}
instance.valueByteArray = CollectionUtils.asByteArray(collection);
} else if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && !StringUtils.hasText(jacksonParser.getValueAsString())) {
ArrayList<Byte> collection = new ArrayList<>();
instance.valueByteArray = CollectionUtils.asByteArray(collection);
}
break;
case "list":
// field valueIntegerList (mapped with "list")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Integer> collection = new ArrayList<>();
Integer 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.readInteger(jacksonParser.getText(), null);
}
collection.add(item);
}
instance.valueIntegerList = collection;
} else if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && !StringUtils.hasText(jacksonParser.getValueAsString())) {
ArrayList<Integer> collection = new ArrayList<>();
instance.valueIntegerList = collection;
}
break;
case "map":
// field valueMapStringInteger (mapped with "map")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
HashMap<String, Integer> collection = new HashMap<>();
String key = null;
Integer value = null;
JsonToken current;
String tempValue = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
current = jacksonParser.currentToken();
for (int i = 0; i < 2; i++) {
while (current != JsonToken.FIELD_NAME) {
current = jacksonParser.nextToken();
}
jacksonParser.nextValue();
switch(jacksonParser.getCurrentName()) {
case "key":
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
key = jacksonParser.getText();
}
break;
case "value":
tempValue = jacksonParser.getValueAsString();
if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && "null".equals(tempValue)) {
value = null;
} else {
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
value = PrimitiveUtils.readInteger(jacksonParser.getText(), null);
}
}
break;
}
}
collection.put(key, value);
key = null;
value = null;
jacksonParser.nextToken();
}
instance.valueMapStringInteger = collection;
}
break;
default:
jacksonParser.skipChildren();
break;
}
}
return instance;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project kripton by xcesco.
the class Bean81V4BindMap method parseOnJacksonAsString.
/**
* parse with jackson
*/
@Override
public Bean81V4 parseOnJacksonAsString(JsonParser jacksonParser) throws Exception {
Bean81V4 instance = new Bean81V4();
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 "id":
// field id (mapped with "id")
instance.id = PrimitiveUtils.readLong(jacksonParser.getText(), 0L);
break;
case "valueByteArray":
// field valueByteArray (mapped with "valueByteArray")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Byte> collection = new ArrayList<>();
Byte 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.readByte(jacksonParser.getText(), null);
}
collection.add(item);
}
instance.valueByteArray = CollectionUtils.asByteArray(collection);
} else if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && !StringUtils.hasText(jacksonParser.getValueAsString())) {
ArrayList<Byte> collection = new ArrayList<>();
instance.valueByteArray = CollectionUtils.asByteArray(collection);
}
break;
case "valueIntegerList":
// field valueIntegerList (mapped with "valueIntegerList")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Integer> collection = new ArrayList<>();
Integer 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.readInteger(jacksonParser.getText(), null);
}
collection.add(item);
}
instance.valueIntegerList = collection;
} else if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && !StringUtils.hasText(jacksonParser.getValueAsString())) {
ArrayList<Integer> collection = new ArrayList<>();
instance.valueIntegerList = collection;
}
break;
case "valueMapStringInteger":
// field valueMapStringInteger (mapped with "valueMapStringInteger")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
HashMap<String, Integer> collection = new HashMap<>();
String key = null;
Integer value = null;
JsonToken current;
String tempValue = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
current = jacksonParser.currentToken();
for (int i = 0; i < 2; i++) {
while (current != JsonToken.FIELD_NAME) {
current = jacksonParser.nextToken();
}
jacksonParser.nextValue();
switch(jacksonParser.getCurrentName()) {
case "key":
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
key = jacksonParser.getText();
}
break;
case "value":
tempValue = jacksonParser.getValueAsString();
if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && "null".equals(tempValue)) {
value = null;
} else {
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
value = PrimitiveUtils.readInteger(jacksonParser.getText(), null);
}
}
break;
}
}
collection.put(key, value);
key = null;
value = null;
jacksonParser.nextToken();
}
instance.valueMapStringInteger = collection;
}
break;
default:
jacksonParser.skipChildren();
break;
}
}
return instance;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonToken in project kripton by xcesco.
the class CountryBindMap method parseOnJacksonAsString.
/**
* parse with jackson
*/
@Override
public Country parseOnJacksonAsString(JsonParser jacksonParser) throws Exception {
Country instance = new Country();
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 "area":
// field area (mapped with "area")
instance.area = PrimitiveUtils.readLong(jacksonParser.getText(), 0L);
break;
case "callingCode":
// field callingCode (mapped with "callingCode")
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
instance.callingCode = jacksonParser.getText();
}
break;
case "code":
// field code (mapped with "code")
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
instance.code = jacksonParser.getText();
}
break;
case "id":
// field id (mapped with "id")
instance.id = PrimitiveUtils.readLong(jacksonParser.getText(), 0L);
break;
case "name":
// field name (mapped with "name")
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
instance.name = jacksonParser.getText();
}
break;
case "region":
// field region (mapped with "region")
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
instance.region = jacksonParser.getText();
}
break;
case "translatedName":
// field translatedName (mapped with "translatedName")
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
HashMap<Translation, String> collection = new HashMap<>();
Translation key = null;
String value = null;
JsonToken current;
String tempValue = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
current = jacksonParser.currentToken();
for (int i = 0; i < 2; i++) {
while (current != JsonToken.FIELD_NAME) {
current = jacksonParser.nextToken();
}
jacksonParser.nextValue();
switch(jacksonParser.getCurrentName()) {
case "key":
{
String tempEnum = jacksonParser.getText();
key = StringUtils.hasText(tempEnum) ? Translation.valueOf(tempEnum) : null;
}
break;
case "value":
tempValue = jacksonParser.getValueAsString();
if (jacksonParser.currentToken() == JsonToken.VALUE_STRING && "null".equals(tempValue)) {
value = null;
} else {
if (jacksonParser.currentToken() != JsonToken.VALUE_NULL) {
value = jacksonParser.getText();
}
}
break;
}
}
collection.put(key, value);
key = null;
value = null;
jacksonParser.nextToken();
}
instance.translatedName = collection;
}
break;
default:
jacksonParser.skipChildren();
break;
}
}
return instance;
}
Aggregations