use of com.abubusoft.kripton.persistence.JacksonWrapperParser in project kripton by xcesco.
the class Bean64BTable method parseValueMapStringBean.
/**
* for attribute valueMapStringBean parsing
*/
public static Map<String, Bean64B> parseValueMapStringBean(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();
Map<String, Bean64B> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
HashMap<String, Bean64B> collection = new HashMap<>();
String key = null;
Bean64B value = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
jacksonParser.nextValue();
key = jacksonParser.getText();
jacksonParser.nextValue();
if (jacksonParser.currentToken() == JsonToken.START_OBJECT) {
value = bean64BBindMap.parseOnJackson(jacksonParser);
}
collection.put(key, value);
key = null;
value = null;
jacksonParser.nextToken();
}
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 BindBean2SharedPreferences method parseValueBigDecimalSet.
/**
* for attribute valueBigDecimalSet parsing
*/
protected HashSet<BigDecimal> parseValueBigDecimalSet(String 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();
HashSet<BigDecimal> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
HashSet<BigDecimal> collection = new HashSet<>();
BigDecimal item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = BigDecimalUtils.read(jacksonParser.getText());
}
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 BindBean2SharedPreferences method parseValueIntegerSet.
/**
* for attribute valueIntegerSet parsing
*/
protected LinkedHashSet<Integer> parseValueIntegerSet(String 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();
LinkedHashSet<Integer> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
LinkedHashSet<Integer> collection = new LinkedHashSet<>();
Integer item = null;
while (jacksonParser.nextToken() != JsonToken.END_ARRAY) {
if (jacksonParser.currentToken() == JsonToken.VALUE_NULL) {
item = null;
} else {
item = jacksonParser.getIntValue();
}
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 BindBean2SharedPreferences method parseValueDoubleSet.
/**
* for attribute valueDoubleSet parsing
*/
protected HashSet<Double> parseValueDoubleSet(String 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();
HashSet<Double> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
HashSet<Double> collection = new HashSet<>();
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 BindBean2SharedPreferences method parseValueCharacterSet.
/**
* for attribute valueCharacterSet parsing
*/
protected Set<Character> parseValueCharacterSet(String 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<Character> result = null;
if (jacksonParser.currentToken() == JsonToken.START_ARRAY) {
HashSet<Character> collection = new HashSet<>();
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 = collection;
}
return result;
} catch (Exception e) {
throw (new KriptonRuntimeException(e.getMessage()));
}
}
Aggregations