use of com.abubusoft.kripton.persistence.JacksonWrapperParser in project kripton by xcesco.
the class CharDaoImpl method parser2.
/**
* for param parser2 parsing
*/
private List<Short> parser2(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<Short> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Short> collection = new ArrayList<>();
Short item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = jacksonParser.getShortValue();
}
collection.add(item);
}
result = collection;
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
use of com.abubusoft.kripton.persistence.JacksonWrapperParser in project kripton by xcesco.
the class DoubleDaoImpl method parser1.
/**
* for param parser1 parsing
*/
private List<Double> 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();
List<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 = collection;
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
use of com.abubusoft.kripton.persistence.JacksonWrapperParser in project kripton by xcesco.
the class LongBeanTable method parseValue.
/**
* for attribute value parsing
*/
public static List<Long> 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();
List<Long> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Long> collection = new ArrayList<>();
Long item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = jacksonParser.getLongValue();
}
collection.add(item);
}
result = collection;
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
use of com.abubusoft.kripton.persistence.JacksonWrapperParser in project kripton by xcesco.
the class LongDaoImpl method parser1.
/**
* for param parser1 parsing
*/
private List<Long> 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();
List<Long> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Long> collection = new ArrayList<>();
Long item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = jacksonParser.getLongValue();
}
collection.add(item);
}
result = collection;
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
use of com.abubusoft.kripton.persistence.JacksonWrapperParser in project kripton by xcesco.
the class ShortBeanTable method parseValue.
/**
* for attribute value parsing
*/
public static List<Short> 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();
List<Short> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
ArrayList<Short> collection = new ArrayList<>();
Short item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = jacksonParser.getShortValue();
}
collection.add(item);
}
result = collection;
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
Aggregations