public interface GraphNode
It can be:
as(Class)
and as(GenericType)
can produce any arbitrary Java type, provided that the underlying serialization
runtime has been correctly configured to support the requested conversion.Modifier and Type | Method and Description |
---|---|
<ResultT> ResultT |
as(Class<ResultT> clazz)
Deserializes and returns this node as an instance of
clazz . |
<ResultT> ResultT |
as(GenericType<ResultT> 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 . |
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.
|
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. |
boolean isNull()
null
value.boolean isMap()
true
if this node is a Map
, and false
otherwise.
If this method returns true
, you can convert this node with asMap()
, or use
keys()
and getByKey(Object)
to access the individual fields (note that
entries are not ordered, so getByIndex(int)
does not work).
Iterable<?> keys()
GraphNode getByKey(Object key)
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
.
boolean isList()
true
if this node is a List
, and false
otherwise.
If this method returns true
, you can convert this node with asList()
, or
use size()
and getByIndex(int)
to access the individual fields.
int size()
0
otherwise.GraphNode getByIndex(int index)
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
.
boolean isValue()
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 asString()
,
asBoolean()
, asInt()
, asLong()
or asDouble()
.
int asInt()
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.
boolean asBoolean()
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.
long asLong()
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.
double asDouble()
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.
String asString()
This method never throws; even incompatible objects (including null
and structured
types like objects and arrays) are converted to the default value.
<ResultT> ResultT as(Class<ResultT> clazz)
clazz
.
Before attempting such a conversion, there must be an appropriate converter configured on the underlying serialization runtime.
<ResultT> ResultT as(GenericType<ResultT> type)
type
.
Before attempting such a conversion, there must be an appropriate converter configured on the underlying serialization runtime.
boolean isVertex()
true
if this node is a Vertex
, and false
otherwise.
If this method returns true
, then asVertex()
can be safely called.
boolean isEdge()
boolean isPath()
boolean isProperty()
true
if this node is a Property
, and false
otherwise.
If this method returns true
, then asProperty()
can be safely called.
boolean isVertexProperty()
true
if this node is a VertexProperty
, and false
otherwise.
If this method returns true
, then asVertexProperty()
()} can be safely
called.
<T> VertexProperty<T> asVertexProperty()
VertexProperty
.boolean isSet()
Copyright © 2017–2019. All rights reserved.