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(GenericType<T> type)
Deserializes and returns this node as an instance of the given
type . |
boolean |
asBoolean()
This node as a boolean, or
false if it can't be converted. |
double |
asDouble()
Returns this node as a long integer, or
0.0D if it can't be converted. |
Edge |
asEdge()
Returns this node as a Tinkerpop
Edge . |
int |
asInt()
This node as an integer, or
0 if it can't be converted. |
<T> List<T> |
asList()
Deserializes and returns this node as a
List . |
long |
asLong()
Returns this node as a long integer, or
0L if it can't be converted. |
<K,V> Map<K,V> |
asMap()
Deserializes and returns this node as a
Map . |
Path |
asPath()
Returns this node as a Tinkerpop
Path . |
<T> Property<T> |
asProperty()
Returns this node as a Tinkerpop
Property . |
<T> Set<T> |
asSet()
Deserializes and returns this node as a
Set . |
String |
asString()
A valid string representation of this node, if the node is a simple node (i.e.
|
Vertex |
asVertex()
Returns this node as a Tinkerpop
Vertex . |
<T> VertexProperty<T> |
asVertexProperty()
Returns this node as a Tinkerpop
VertexProperty . |
boolean |
equals(Object other) |
GraphNode |
getByIndex(int index)
Returns the element at the given index as a node.
|
GraphNode |
getByKey(Object key)
Returns the value for the given key as a node.
|
int |
hashCode() |
boolean |
isEdge()
|
boolean |
isList()
|
boolean |
isMap()
|
boolean |
isNull()
Whether this node represents a
null value. |
boolean |
isPath()
|
boolean |
isProperty()
|
boolean |
isSet()
|
boolean |
isValue()
Returns
true if this node is a simple scalar value, (i.e., string, boolean or number),
and false otherwise. |
boolean |
isVertex()
|
boolean |
isVertexProperty()
|
Iterable<?> |
keys()
The keys of this map node, or an empty iterator if it is not a map.
|
int |
size()
The size of the current node, if it is a list or map, or
0 otherwise. |
String |
toString() |
public ObjectGraphNode(Object delegate)
public boolean isNull()
GraphNode
null
value.public boolean isMap()
GraphNode
true
if this node is a Map
, and false
otherwise.
If this method returns true
, you can convert this node with GraphNode.asMap()
, or use
GraphNode.keys()
and GraphNode.getByKey(Object)
to access the individual fields (note that
entries are not ordered, so GraphNode.getByIndex(int)
does not work).
public Iterable<?> keys()
GraphNode
public GraphNode getByKey(Object key)
GraphNode
If this node is not a map, or does not contain the specified key, null
is returned.
If the property value has been explicitly set to null
, implementors may return a
special "null node" instead of null
.
public <K,V> Map<K,V> asMap()
GraphNode
Map
.public boolean isList()
GraphNode
true
if this node is a List
, and false
otherwise.
If this method returns true
, you can convert this node with GraphNode.asList()
, or
use GraphNode.size()
and GraphNode.getByIndex(int)
to access the individual fields.
public int size()
GraphNode
0
otherwise.public GraphNode getByIndex(int index)
GraphNode
If this node is not a list, or 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
.
getByIndex
in interface GraphNode
public <T> List<T> asList()
GraphNode
List
.public boolean isValue()
GraphNode
true
if this node is a simple scalar value, (i.e., string, boolean or number),
and false
otherwise.
If this method returns true
, you can convert this node with GraphNode.asString()
,
GraphNode.asBoolean()
, GraphNode.asInt()
, GraphNode.asLong()
or GraphNode.asDouble()
.
public boolean isVertexProperty()
GraphNode
true
if this node is a VertexProperty
, and false
otherwise.
If this method returns true
, then GraphNode.asVertexProperty()
()} can be safely
called.
isVertexProperty
in interface GraphNode
public boolean isProperty()
GraphNode
true
if this node is a Property
, and false
otherwise.
If this method returns true
, then GraphNode.asProperty()
can be safely called.
isProperty
in interface GraphNode
public boolean isPath()
GraphNode
true
if this node is a Path
, and false
otherwise.
If this method returns true
, then GraphNode.asPath()
can be safely called.
public int asInt()
GraphNode
0
if it can't be converted.
This method never throws; even incompatible objects (including null
and structured
types like objects and arrays) are converted to the default value.
public boolean asBoolean()
GraphNode
false
if it can't be converted.
This method never throws; even incompatible objects (including null
and structured
types like objects and arrays) are converted to the default value.
public long asLong()
GraphNode
0L
if it can't be converted.
This method never throws; even incompatible objects (including null
and structured
types like objects and arrays) are converted to the default value.
public double asDouble()
GraphNode
0.0D
if it can't be converted.
This method never throws; even incompatible objects (including null
and structured
types like objects and arrays) are converted to the default value.
public String asString()
GraphNode
This method never throws; even incompatible objects (including null
and structured
types like objects and arrays) are converted to the default value.
public <T> T as(Class<T> clazz)
GraphNode
clazz
.
Before attempting such a conversion, there must be an appropriate converter configured on the underlying serialization runtime.
public <T> T as(GenericType<T> type)
GraphNode
type
.
Before attempting such a conversion, there must be an appropriate converter configured on the underlying serialization runtime.
public boolean isVertex()
GraphNode
true
if this node is a Vertex
, and false
otherwise.
If this method returns true
, then GraphNode.asVertex()
can be safely called.
public Vertex asVertex()
GraphNode
Vertex
.public boolean isEdge()
GraphNode
true
if this node is a Edge
, and false
otherwise.
If this method returns true
, then GraphNode.asEdge()
can be safely called.
public Edge asEdge()
GraphNode
Edge
.public Path asPath()
GraphNode
Path
.public <T> Property<T> asProperty()
GraphNode
Property
.asProperty
in interface GraphNode
public <T> VertexProperty<T> asVertexProperty()
GraphNode
VertexProperty
.asVertexProperty
in interface GraphNode
public boolean isSet()
GraphNode
true
if this node is a Set
, and false
otherwise.
If this method returns true
, you can convert this node with GraphNode.asSet()
, or use
GraphNode.size()
.
public <T> Set<T> asSet()
GraphNode
Set
.Copyright © 2017–2019. All rights reserved.