Java Code Examples for javax.json.JsonValue.ValueType#TRUE
The following examples show how to use
javax.json.JsonValue.ValueType#TRUE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NetworkConfig.java From fabric-sdk-java with Apache License 2.0 | 5 votes |
private static Boolean getJsonValueAsBoolean(JsonValue value) { if (value != null) { if (value.getValueType() == ValueType.TRUE) { return true; } else if (value.getValueType() == ValueType.FALSE) { return false; } } return null; }
Example 2
Source File: JSONContentHandler.java From jcypher with Apache License 2.0 | 5 votes |
@Override public Object convertContentValue(Object value) { if (value instanceof JsonValue) { JsonValue val = (JsonValue) value; Object ret = null; ValueType typ = val.getValueType(); if (typ == ValueType.NUMBER) ret = ((JsonNumber)val).bigDecimalValue(); else if (typ == ValueType.STRING) ret = ((JsonString)val).getString(); else if (typ == ValueType.FALSE) ret = Boolean.FALSE; else if (typ == ValueType.TRUE) ret = Boolean.TRUE; else if (typ == ValueType.ARRAY) { JsonArray arr = (JsonArray)val; List<Object> vals = new ArrayList<Object>(); int sz = arr.size(); for (int i = 0; i < sz; i++) { JsonValue v = arr.get(i); vals.add(convertContentValue(v)); } ret = vals; } else if (typ == ValueType.OBJECT) { //JsonObject obj = (JsonObject)val; } return ret; } return value; }