Class SerializableNode<ID>
- java.lang.Object
-
- com.graphaware.common.representation.DetachedEntity<ID,Node>
-
- com.graphaware.common.representation.DetachedNode<ID>
-
- com.graphaware.common.representation.SerializableNode<ID>
-
- Type Parameters:
ID
- type of custom node ID.
- All Implemented Interfaces:
DetachedNodeExpressions
,EntityExpressions
,Serializable
- Direct Known Subclasses:
JsonNode
public class SerializableNode<ID> extends DetachedNode<ID>
SerializableDetachedNode
with custom node ID. It is recommended not to expose Neo4j internal IDs (graphId) outside of the database.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.graphaware.common.representation.DetachedEntity
NEW
-
-
Constructor Summary
Constructors Constructor Description SerializableNode()
Public no-arg constructor (for Jackson et.SerializableNode(ID id)
Create a SerializableDetachedNode
from custom node ID.SerializableNode(ID id, String[] labels, Map<String,Object> properties)
Construct SerializableDetachedNode
of a node.SerializableNode(Node node, NodeIdTransformer<ID> transformer)
Create a SerializableDetachedNode
from a Neo4j node.SerializableNode(Node node, String[] properties, NodeIdTransformer<ID> transformer)
Create a SerializableDetachedNode
from a Neo4j node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
ID
getId()
int
hashCode()
Node
produceEntity(Transaction tx, NodeIdTransformer<ID> transformer)
Produce aNode
from this representation.void
setId(ID id)
-
Methods inherited from class com.graphaware.common.representation.DetachedNode
checkCanFetch, create, fetch, getLabels, populate, setLabels
-
Methods inherited from class com.graphaware.common.representation.DetachedEntity
checkCanCreate, getGraphId, getProperties, produceEntity, propertyKeySetAsStringArray, putProperty, setGraphId, setProperties
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.graphaware.common.expression.DetachedNodeExpressions
hasLabel
-
Methods inherited from interface com.graphaware.common.expression.EntityExpressions
getProperties, getProperty, getProperty, hasProperty
-
-
-
-
Constructor Detail
-
SerializableNode
public SerializableNode()
Public no-arg constructor (for Jackson et. al.)
-
SerializableNode
public SerializableNode(Node node, NodeIdTransformer<ID> transformer)
Create a SerializableDetachedNode
from a Neo4j node. All properties will be included.- Parameters:
node
- node to create the representation from.transformer
- ID transformer.
-
SerializableNode
public SerializableNode(Node node, String[] properties, NodeIdTransformer<ID> transformer)
Create a SerializableDetachedNode
from a Neo4j node.- Parameters:
node
- node to create the representation from. Must not benull
.properties
- keys of properties to be included in the representation. Can benull
, which represents all. Empty array represents none.transformer
- ID transformer.
-
SerializableNode
public SerializableNode(ID id)
Create a SerializableDetachedNode
from custom node ID.- Parameters:
id
- custom ID of the node. Can benull
to represent a new node.
-
SerializableNode
public SerializableNode(ID id, String[] labels, Map<String,Object> properties)
Construct SerializableDetachedNode
of a node.- Parameters:
id
- custom ID of the node. Can benull
to represent a new node.labels
- of the new node representation.properties
- of the new node representation.
-
-
Method Detail
-
produceEntity
public Node produceEntity(Transaction tx, NodeIdTransformer<ID> transformer)
Produce aNode
from this representation. This means either fetch the node from the given tx (iff id is set), or create it.- Parameters:
tx
- to create/fetch node in.transformer
- ID transformer.- Returns:
- node.
-
getId
public ID getId()
- Specified by:
getId
in classDetachedEntity<ID,Node>
-
setId
public void setId(ID id)
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classDetachedNode<ID>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classDetachedNode<ID>
-
-