public class JObjectNode extends AbstractJNode implements JNode
parent, type
Constructor and Description |
---|
JObjectNode()
Default constructor for detached node.
|
JObjectNode(JNode fParent)
Constructor for node attached to tree.
|
Modifier and Type | Method and Description |
---|---|
<K,T extends JNode> |
addNode(K pKey,
T jnode)
Add element to composite node.
|
<T extends JNode> |
addNode(T jnode)
Add element to composite node (without name).
|
JNode |
clone()
Return copy of this object, detached from node tree.
|
boolean |
equals(java.lang.Object obj) |
java.util.Set<java.lang.String> |
fieldNames()
Returns set of field names.
|
java.util.List<JNode> |
getChildren()
Returns set of all children of composite (Object or Array) node.
|
<T> JNode |
getNode(T name)
Returns child node of this node by selector.
|
int |
hashCode() |
java.util.Iterator<JNode> |
iterator()
Returns iterator over elements of composite node.
|
<K> void |
removeNode(K selector)
Remove child node of this node by selector.
|
<N extends JNode> |
removeNode(N node)
Remove child node of this node.
|
java.lang.String |
toJson()
Return this node as a JSON document.
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String indent,
boolean showPath,
boolean deep)
Return printable (well formatted) text represents this node.
|
getDocRoot, getKey, getParent, getPath, getType, getValue, getValue, setKey, setValue
public JObjectNode()
public JObjectNode(JNode fParent)
fParent
- reference to parent node.public <T> JNode getNode(T name)
JNode
public java.util.List<JNode> getChildren()
JNode
getChildren
in interface JNode
getChildren
in class AbstractJNode
public JNode clone()
JNode
clone
in interface JNode
clone
in class AbstractJNode
public <T extends JNode> void addNode(T jnode)
JNode
public <K,T extends JNode> void addNode(K pKey, T jnode)
JNode
public <K> void removeNode(K selector)
JNode
removeNode
in interface JNode
K
- type of the selector: Integer or String.selector
- is index or key.public <N extends JNode> void removeNode(N node)
JNode
removeNode
in interface JNode
N
- type of nodenode
- to removepublic java.util.Iterator<JNode> iterator()
JNode
iterator
in interface JNode
iterator
in interface java.lang.Iterable<JNode>
iterator
in class AbstractJNode
Iterable
public java.util.Set<java.lang.String> fieldNames()
JInstrumentalNode
fieldNames
in interface JInstrumentalNode
fieldNames
in class AbstractJNode
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String indent, boolean showPath, boolean deep)
JNode
public java.lang.String toJson()
JNode
public int hashCode()
hashCode
in class AbstractJNode
public boolean equals(java.lang.Object obj)
equals
in class AbstractJNode