Interface GraphNode
-
- All Known Subinterfaces:
ReactiveGraphNode
public interface GraphNodeA node in a tree-like structure representing a Graph or a Graph component.It can be:
- a scalar value of a primitive type (boolean, string, int, long, double);
- a graph element (vertex, edge, path or property);
- a list of nodes;
- a set of nodes;
- a map of nodes.
as(Class)andas(GenericType)can produce any arbitrary Java type, provided that the underlying serialization runtime has been correctly configured to support the requested conversion.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <ResultT> ResultTas(GenericType<ResultT> type)Deserializes and returns this node as an instance of the giventype.<ResultT> ResultTas(Class<ResultT> clazz)Deserializes and returns this node as an instance ofclazz.booleanasBoolean()Returns this node as a boolean.doubleasDouble()Returns this node as a long integer.org.apache.tinkerpop.gremlin.structure.EdgeasEdge()Returns this node as a TinkerpopEdge.intasInt()Returns this node as an integer.<T> List<T>asList()Deserializes and returns this node as aList.longasLong()Returns this node as a long integer.<K,V>
Map<K,V>asMap()Deserializes and returns this node as aMap.org.apache.tinkerpop.gremlin.process.traversal.PathasPath()Returns this node as a TinkerpopPath.<T> org.apache.tinkerpop.gremlin.structure.Property<T>asProperty()Returns this node as a TinkerpopProperty.<T> Set<T>asSet()Deserializes and returns this node as aSet.StringasString()A valid string representation of this node.org.apache.tinkerpop.gremlin.structure.VertexasVertex()Returns this node as a TinkerpopVertex.<T> org.apache.tinkerpop.gremlin.structure.VertexProperty<T>asVertexProperty()Returns this node as a TinkerpopVertexProperty.GraphNodegetByIndex(int index)Returns the element at the given index as a node.GraphNodegetByKey(Object key)Returns the value for the given key as a node.booleanisEdge()Returnstrueif this node is aEdge, andfalseotherwise.booleanisList()booleanisMap()booleanisNull()Whether this node represents anullvalue.booleanisPath()Returnstrueif this node is aPath, andfalseotherwise.booleanisProperty()Returnstrueif this node is aProperty, andfalseotherwise.booleanisSet()booleanisValue()Returnstrueif this node is a simple scalar value, (i.e., string, boolean or number), andfalseotherwise.booleanisVertex()Returnstrueif this node is aVertex, andfalseotherwise.booleanisVertexProperty()Returnstrueif this node is aVertexProperty, andfalseotherwise.Iterable<?>keys()The keys of this map node, or an empty iterator if it is not a map.intsize()The size of the current node, if it is a list or map, or0otherwise.
-
-
-
Method Detail
-
isNull
boolean isNull()
Whether this node represents anullvalue.
-
isMap
boolean isMap()
Returnstrueif this node is aMap, andfalseotherwise.If this method returns
true, you can convert this node withasMap(), or usekeys()andgetByKey(Object)to access the individual fields (note that entries are not ordered, sogetByIndex(int)does not work).
-
keys
Iterable<?> keys()
The keys of this map node, or an empty iterator if it is not a map.
-
getByKey
GraphNode getByKey(Object key)
Returns the value for the given key as a node.If this node is not a map, or does not contain the specified key,
nullis returned.If the property value has been explicitly set to
null, implementors may return a special "null node" instead ofnull.
-
isList
boolean isList()
Returnstrueif this node is aList, andfalseotherwise.If this method returns
true, you can convert this node withasList(), or usesize()andgetByIndex(int)to access the individual fields.
-
size
int size()
The size of the current node, if it is a list or map, or0otherwise.
-
getByIndex
GraphNode getByIndex(int index)
Returns the element at the given index as a node.If this node is not a list, or
indexis out of bounds (i.e. less than zero or>= size(),nullis returned; no exception will be thrown.If the requested element has been explicitly set to
null, implementors may return a special "null node" instead ofnull.
-
isValue
boolean isValue()
Returnstrueif this node is a simple scalar value, (i.e., string, boolean or number), andfalseotherwise.If this method returns
true, you can convert this node withasString(),asBoolean(),asInt(),asLong()orasDouble().
-
asInt
int asInt()
Returns this node as an integer.If the underlying object is not convertible to integer, implementors may choose to either throw
ClassCastExceptionor return [null | empty | some default value], whichever is deemed more appropriate.
-
asBoolean
boolean asBoolean()
Returns this node as a boolean.If the underlying object is not convertible to boolean, implementors may choose to either throw
ClassCastExceptionor return [null | empty | some default value], whichever is deemed more appropriate.
-
asLong
long asLong()
Returns this node as a long integer.If the underlying object is not convertible to long, implementors may choose to either throw
ClassCastExceptionor return [null | empty | some default value], whichever is deemed more appropriate.
-
asDouble
double asDouble()
Returns this node as a long integer.If the underlying object is not convertible to double, implementors may choose to either throw
ClassCastExceptionor return [null | empty | some default value], whichever is deemed more appropriate.
-
asString
String asString()
A valid string representation of this node.If the underlying object is not convertible to a string, implementors may choose to either throw
ClassCastExceptionor return an empty string, whichever is deemed more appropriate.
-
as
<ResultT> ResultT as(Class<ResultT> clazz)
Deserializes and returns this node as an instance ofclazz.Before attempting such a conversion, there must be an appropriate converter configured on the underlying serialization runtime.
-
as
<ResultT> ResultT as(GenericType<ResultT> type)
Deserializes and returns this node as an instance of the giventype.Before attempting such a conversion, there must be an appropriate converter configured on the underlying serialization runtime.
-
isVertex
boolean isVertex()
Returnstrueif this node is aVertex, andfalseotherwise.If this method returns
true, thenasVertex()can be safely called.
-
asVertex
org.apache.tinkerpop.gremlin.structure.Vertex asVertex()
Returns this node as a TinkerpopVertex.
-
isEdge
boolean isEdge()
Returnstrueif this node is aEdge, andfalseotherwise.If this method returns
true, thenasEdge()can be safely called.
-
asEdge
org.apache.tinkerpop.gremlin.structure.Edge asEdge()
Returns this node as a TinkerpopEdge.
-
isPath
boolean isPath()
Returnstrueif this node is aPath, andfalseotherwise.If this method returns
true, thenasPath()can be safely called.
-
asPath
org.apache.tinkerpop.gremlin.process.traversal.Path asPath()
Returns this node as a TinkerpopPath.
-
isProperty
boolean isProperty()
Returnstrueif this node is aProperty, andfalseotherwise.If this method returns
true, thenasProperty()can be safely called.
-
asProperty
<T> org.apache.tinkerpop.gremlin.structure.Property<T> asProperty()
Returns this node as a TinkerpopProperty.
-
isVertexProperty
boolean isVertexProperty()
Returnstrueif this node is aVertexProperty, andfalseotherwise.If this method returns
true, thenasVertexProperty()()} can be safely called.
-
asVertexProperty
<T> org.apache.tinkerpop.gremlin.structure.VertexProperty<T> asVertexProperty()
Returns this node as a TinkerpopVertexProperty.
-
isSet
boolean isSet()
-
-