public class JValueNode<V> extends AbstractJNode
parent, type
Constructor and Description |
---|
JValueNode()
Default constructor for detached node.
|
JValueNode(JNode fParent)
Constructor for node attached to tree.
|
JValueNode(JNode fParent,
V val)
Constructor for node attached to tree.
|
JValueNode(V val)
Constructor for detached node.
|
Modifier and Type | Method and Description |
---|---|
void |
addNode(JNode node)
Add element to composite node (without name).
|
<K,T extends JNode> |
addNode(K idx,
T node)
Add element to composite node.
|
JNode |
clone()
Return copy of this object, detached from node tree.
|
boolean |
equals(java.lang.Object obj) |
<T> JNode |
getNode(T selector)
Returns child node of this node by selector.
|
V |
getValue()
Return value of JValueNode.
|
<V1> V1 |
getValue(java.lang.Class<V1> pType)
Return value of JValueNode.
|
int |
hashCode() |
<N extends JNode> |
removeNode(N node)
Remove child node of this node.
|
<T> void |
removeNode(T selector)
Remove child node of this node by selector.
|
<V1> void |
setValue(V1 value)
Set value of V type for 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.
|
fieldNames, getChildren, getDocRoot, getKey, getParent, getPath, getType, iterator, setKey
public JValueNode()
public JValueNode(V val)
val
- value of the node.public JValueNode(JNode fParent)
fParent
- parent node in tree.public JNode clone()
JNode
clone
in interface JNode
clone
in class AbstractJNode
public V getValue()
JNode
getValue
in interface JNode
getValue
in class AbstractJNode
public <V1> V1 getValue(java.lang.Class<V1> pType)
JNode
getValue
in interface JNode
getValue
in class AbstractJNode
V1
- type of returned value: Integer, Boolean, Float, Double or String.pType
- class that represents returned value.public <V1> void setValue(V1 value)
JNode
setValue
in interface JNode
setValue
in class AbstractJNode
V1
- type of valuevalue
- to set for the node.public <T> JNode getNode(T selector)
JNode
T
- type of the selector: Integer or String.selector
- is index or key.public <K,T extends JNode> void addNode(K idx, T node)
JNode
K
- class of key (String for field name, Integer for node in JArray).T
- class of added node.idx
- name of the fieldnode
- to be added.public void addNode(JNode node)
JNode
node
- to be added.public <T> void removeNode(T selector)
JNode
T
- type of the selector: Integer or String.selector
- is index or key.public <N extends JNode> void removeNode(N node)
JNode
N
- type of nodenode
- to removepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String indent, boolean showPath, boolean deep)
JNode
indent
- represent indentation for formatting text.showPath
- if true then the method insert path information in output.deep
- if true then the method will output children recursively.public java.lang.String toJson()
JNode
public int hashCode()
hashCode
in class AbstractJNode
public boolean equals(java.lang.Object obj)
equals
in class AbstractJNode