Constructor and Description |
---|
ObjectGraphNode(Object delegate) |
Modifier and Type | Method and Description |
---|---|
<T> T |
as(Class<T> clazz)
Deserializes and returns this node as an instance of
clazz . |
<T> T |
as(TypeToken<T> type)
Deserializes and returns this node as an instance of the given
type . |
boolean |
asBoolean()
Returns this node as a boolean.
|
double |
asDouble()
Returns this node as a double.
|
Edge |
asEdge()
Returns this node as an
Edge . |
int |
asInt()
Returns this node as an integer.
|
long |
asLong()
Returns this node as a long integer.
|
Map<String,Object> |
asMap()
Deserializes and returns this node as an instance of
Map<String, Object> . |
Path |
asPath()
Returns this node as a
Path . |
Property |
asProperty()
Returns this node as a
Property . |
String |
asString()
Returns a valid String representation of this node, if the node is a simple node (i.e.
|
Vertex |
asVertex()
Returns this node as a
Vertex . |
VertexProperty |
asVertexProperty()
Returns this node as a
VertexProperty . |
boolean |
equals(Object other) |
Iterator<String> |
fieldNames()
Returns all the field names of the current node, if it is an object, or an empty iterator
otherwise.
|
GraphNode |
get(int index)
Returns the element node at the specified
index of an array node. |
GraphNode |
get(String fieldName)
Returns the value of the specified field of an object node.
|
int |
hashCode() |
boolean |
isArray()
Returns whether this node is an array.
|
boolean |
isEdge()
Returns
true if this node is an edge. |
boolean |
isNull()
Returns whether this node is
null . |
boolean |
isObject()
Returns whether this node is an object.
|
boolean |
isValue()
Returns whether this node is a simple value, i.e.
|
boolean |
isVertex()
Returns
true if this node is a vertex. |
int |
size()
Returns the size of the current node, if it is an array, or
0 otherwise. |
String |
toString() |
public ObjectGraphNode(Object delegate)
public boolean isNull()
Node
null
.public boolean isObject()
Node
Only one method out of Node.isObject()
, Node.isArray()
and Node.isValue()
should
ever return true
for one given node.
public boolean isArray()
Node
Only one method out of Node.isObject()
, Node.isArray()
and Node.isValue()
should
ever return true
for one given node.
public boolean isValue()
Node
null
.
Only one method out of Node.isObject()
, Node.isArray()
and Node.isValue()
should
ever return true
for one given node.
public Iterator<String> fieldNames()
Node
fieldNames
in interface Node
Iterator
of all the field names of the current node.public int size()
Node
0
otherwise.public int asInt()
Node
If this node can not be converted to an int (including structured types like Objects and
Arrays), 0
will be returned; no exceptions will be thrown.
public boolean asBoolean()
Node
If this node can not be converted to a boolean (including structured types like Objects and
Arrays), false
will be returned; no exceptions will be thrown.
public long asLong()
Node
public double asDouble()
Node
public String asString()
Node
public Map<String,Object> asMap()
Node
Map<String, Object>
.public <T> T as(Class<T> clazz)
Node
clazz
.
Before attempting such a conversion, there must be an appropriate converter configured on the underlying serialization runtime.
public <T> T as(TypeToken<T> type)
Node
type
.
Before attempting such a conversion, there must be an appropriate converter configured on the underlying serialization runtime.
public GraphNode get(String fieldName)
Node
If this node is not an object (or it does not have a value for the specified field name), or
if there is no field with such name, null
is returned.
If the property value has been explicitly set to null
, implementors may return a
special "null node" instead of null
.
public GraphNode get(int index)
Node
index
of an array node.
For all other node types, null
is returned.
If index
is out of bounds, (i.e. less than zero or >= size()
, null
is returned; no exception will be thrown.
If the requested element has been explicitly set to null
, implementors may return a
special "null node" instead of null
.
public boolean isVertex()
GraphNode
true
if this node is a vertex.
If this node is a vertex, then GraphNode.asVertex()
can be safely called.
public boolean isEdge()
GraphNode
true
if this node is an edge.
If this node is an edge, then GraphNode.asEdge()
can be safely called.
public Vertex asVertex()
GraphNode
Vertex
.public Edge asEdge()
GraphNode
Edge
.public Path asPath()
GraphNode
Path
.public Property asProperty()
GraphNode
Property
.asProperty
in interface GraphNode
Property
representation of this node.public VertexProperty asVertexProperty()
GraphNode
VertexProperty
.asVertexProperty
in interface GraphNode
VertexProperty
representation of this node.Copyright © 2012–2019. All rights reserved.