Class RMJSONNode
- java.lang.Object
- 
- com.inductiveautomation.rm.archiver.RMJSONNode
 
- 
 public class RMJSONNode extends java.lang.ObjectRepresents a node in a JSON tree.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classRMJSONNode.Type
 - 
Constructor SummaryConstructors Constructor Description RMJSONNode()Creates a new node.RMJSONNode(java.lang.Object aSource)Creates a new node.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RMJSONNodeget(int anIndex)Returns the individual node at given index.RMJSONNodeget(java.lang.String aKey)Returns value for key if node type Map.java.lang.BooleangetBoolean()Returns the value as Map if type is Map.protected RMJSONNodegetJSON(java.lang.Object anObj)Returns a JSON node of given value.java.util.List<java.lang.String>getKeys()Returns keys list.java.util.ListgetList()Returns the value as List if type is List.java.util.Map<java.lang.String,java.lang.Object>getMap()Returns the value as Map if type is Map.java.lang.ObjectgetNonJSON()Converts a JSON object to Map.java.lang.NumbergetNumber()Returns the value as Number if type is Number.java.lang.StringgetString()Returns the value as String if type is String.RMJSONNode.TypegetType()Returns the the node type.java.lang.ObjectgetValue()Returns the value.static voidmain(java.lang.String[] args)Simple main implementation to read standard in and re-print JSON.RMJSONNodeput(java.lang.String aKey, java.lang.Object aValue)Sets value for key.static RMJSONNodereadSource(java.lang.Object aSource)Creates a JSON node tree from a JSON string or JSON String byte source.protected voidsetType(RMJSONNode.Type aType)Sets the node type.protected RMJSONNodesetValue(java.lang.Object anObj)Sets the value.intsize()Returns the number of JSON nodes if node type List.java.lang.StringtoString()Returns a string representation of node (as JSON, of course).java.lang.StringtoStringCompacted()Returns a string representation of node (as JSON, of course).
 
- 
- 
- 
Method Detail- 
readSourcepublic static RMJSONNode readSource(java.lang.Object aSource) throws RMJSONReader.RMJSONException Creates a JSON node tree from a JSON string or JSON String byte source.- Throws:
- RMJSONReader.RMJSONException
 
 - 
getTypepublic RMJSONNode.Type getType() Returns the the node type.
 - 
setTypeprotected void setType(RMJSONNode.Type aType) Sets the node type.
 - 
getValuepublic java.lang.Object getValue() Returns the value.
 - 
setValueprotected RMJSONNode setValue(java.lang.Object anObj) Sets the value.
 - 
getpublic RMJSONNode get(java.lang.String aKey) Returns value for key if node type Map.
 - 
putpublic RMJSONNode put(java.lang.String aKey, java.lang.Object aValue) Sets value for key.
 - 
getKeyspublic java.util.List<java.lang.String> getKeys() Returns keys list.
 - 
sizepublic int size() Returns the number of JSON nodes if node type List.
 - 
getpublic RMJSONNode get(int anIndex) Returns the individual node at given index.
 - 
getJSONprotected RMJSONNode getJSON(java.lang.Object anObj) Returns a JSON node of given value.
 - 
getMappublic java.util.Map<java.lang.String,java.lang.Object> getMap() Returns the value as Map if type is Map.
 - 
getListpublic java.util.List getList() Returns the value as List if type is List.
 - 
getStringpublic java.lang.String getString() Returns the value as String if type is String.
 - 
getNumberpublic java.lang.Number getNumber() Returns the value as Number if type is Number.
 - 
getBooleanpublic java.lang.Boolean getBoolean() Returns the value as Map if type is Map.
 - 
getNonJSONpublic java.lang.Object getNonJSON() Converts a JSON object to Map.
 - 
toStringpublic java.lang.String toString() Returns a string representation of node (as JSON, of course).- Overrides:
- toStringin class- java.lang.Object
 
 - 
toStringCompactedpublic java.lang.String toStringCompacted() Returns a string representation of node (as JSON, of course).
 - 
mainpublic static void main(java.lang.String[] args) Simple main implementation to read standard in and re-print JSON.
 
- 
 
-