Modifier and Type | Class and Description |
---|---|
static class |
JNode.Type |
Modifier and Type | Method and Description |
---|---|
JNode |
findEach(String query)
Searches descendant nodes and returns a JNodes container that holds all
JNodes matching the query, not including those nodes that are descendants
of any matching nodes (ie, excludes nested matches); returns an empty JNodes
container if no matching JNodes were found or if the method is invoked on a leaf node.
|
JNode |
findEvery(String query)
Searches descendant nodes and returns a JNodes container that holds all
JNodes matching the query; returns an empty JNodes container if no matching
JNodes were found or if the method is invoked on a leaf node.
|
JNode |
findFirst(String query)
Searches descendant nodes and retrieves the first
JNode that matches the specified query, or throws a NotFound Exception if
no matching JNode is found; throws a NotFound Exception if
no matching JNode is found, or if this method is invoked on a leaf node.
|
JNode |
get(int index)
Returns the JNode at the specified position or throws a NotFound Exception if the specified position is out of bounds.
|
JNode |
get(String name)
Returns the child node associated with the specified name or throws a NotFound Exception if the name does not exist as a key; if the specified name is associated with the value null, then a JNode of Type.UNDEFINED is returned.
|
JNode |
getEach(String query)
Searches only child nodes (not all descendants) and returns a JNodes
container that holds all JNodes matching the query; returns an empty JNodes container
if no matching JNodes were found or if the method is invoked on a leaf node.
|
JNode |
getFirst(String query)
Searches only child nodes (not all descendants) and retrieves the first
JNode that matches the specified query; throws a NotFound Exception if
no matching JNode is found, or if this method is invoked on a leaf node.
|
String |
getName()
Returns the name associated with this node, or null if the node is not associated with a name (such as the root node, or nodes in an array).
|
JNode |
getParent()
Returns the parent node or null if no parent node exists (such as for the root Node).
|
JNode.Type |
getType()
Returns the node type as defined by the node type constants in this class.
|
boolean |
isPrimitive()
Returns true if this node is a primitive type; ie, if the
getType() method returns TYPE_STRING, TYPE_BOOLEAN, TYPE_NUMBER, or TYPE_UNDEFINED) |
Iterator<JNode> |
iterator()
If this JNode is of TYPE_OBJECT, returns returns an iterator over the child JNodes; otherwise returns null.
|
int |
size()
If this Node does not represent a JSON object or array, return -1; otherwise returns the number of child nodes in the object/array.
|
boolean |
toBoolean()
Returns a primitive boolean representation of this Node.
|
double |
toDouble()
Returns a primitive double representation of this Node.
|
float |
toFloat()
Returns a primitive float representation of this Node.
|
int |
toInt()
Returns a primitive int representation of this Node.
|
long |
toLong()
Returns a primitive long representation of this Node.
|
String |
toString()
Returns a String representation of this Node.
|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public boolean isPrimitive()
getType()
method returns TYPE_STRING, TYPE_BOOLEAN, TYPE_NUMBER, or TYPE_UNDEFINED)public JNode getFirst(String query) throws NotFound
query
- a query that has the general form:"nodeNameRegex": {"attributeName":"attributeValueRegex"}
NotFound
public JNode getEach(String query) throws NotFound
query
- a query that has the general form:"nodeNameRegex": {"attributeName":"attributeValueRegex"}
NotFound
public JNode findFirst(String query) throws NotFound
query
- a query that has the general form:"nodeNameRegex": {"attributeName":"attributeValueRegex"}
NotFound
public JNode findEach(String query) throws NotFound
query
- a query that has the general form:"nodeNameRegex": {"attributeName":"attributeValueRegex"}
NotFound
public JNode findEvery(String query) throws NotFound
query
- a query that has the general form:"nodeNameRegex": {"attributeName":"attributeValueRegex"}
NotFound
public JNode getParent()
public JNode.Type getType()
public String getName()
public JNode get(String name) throws NotFound
NotFound
public JNode get(int index) throws NotFound
NotFound
public int size()
public String toString()
public boolean toBoolean()
public int toInt()
public float toFloat()
public double toDouble()
public long toLong()