Package nxt.addons
Class JO
java.lang.Object
java.util.AbstractMap
nxt.addons.JO
- All Implemented Interfaces:
Map
Delegate json object operations to json simple and wrap it with convenience methods
This class does not really keep a map, but it implements a map in order to delegate entrySet to the underlying JSONArray
in order to support streaming into String.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JOReturns a non-deep copy of the provided JO.entrySet()booleangetBoolean(String key) booleangetBoolean(String key, boolean defaultValue) bytebytedoubledoublelonggetEntityId(String key) floatfloatintintlonglongshortshortbooleanstatic JOstatic JObyte[]parseHexString(String key) voidorg.json.simple.JSONObjectstatic JOunmodifiable(JO jo) Returns an unmodifiable version of a JSON object.static JOstatic JOMethods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
JO
public JO() -
JO
public JO(org.json.simple.JSONObject jo) -
JO
-
-
Method Details
-
toJSONObject
public org.json.simple.JSONObject toJSONObject() -
put
-
put
- Specified by:
putin interfaceMap- Overrides:
putin classAbstractMap
-
getArray
-
getJoList
-
valueOf
-
valueOf
-
parse
-
parse
-
get
-
getJo
-
getEntityId
-
entrySet
- Specified by:
entrySetin interfaceMap- Specified by:
entrySetin classAbstractMap
-
toJSONString
-
getLong
-
getLong
-
getInt
-
getInt
-
getDouble
-
getDouble
-
getFloat
-
getFloat
-
getShort
-
getShort
-
getByte
-
getByte
-
getBoolean
-
getBoolean
-
getString
-
getString
-
parseHexString
-
isExist
-
copy
Returns a non-deep copy of the provided JO.- Parameters:
jo- JSON object- Returns:
- Copied object
-
unmodifiable
Returns an unmodifiable version of a JSON object. The result is not deeply unmodifiable - sub-objects or sub-arrays can be modified.- Parameters:
jo- TheJOto make unmodifiable- Returns:
- An unmodifiable JO with same content as the provided JO
-