Spring Data Graph

org.springframework.data.neo4j.support.node
Class PartialNodeEntityInstantiator

java.lang.Object
  extended by org.springframework.data.neo4j.support.node.PartialNodeEntityInstantiator
All Implemented Interfaces:
org.springframework.data.persistence.EntityInstantiator<NodeBacked,org.neo4j.graphdb.Node>

public class PartialNodeEntityInstantiator
extends Object
implements org.springframework.data.persistence.EntityInstantiator<NodeBacked,org.neo4j.graphdb.Node>

Entity instantiator for Node entities that takes into account that the entity is persisted in a JPA store as well.

Since:
02.10.2010
Author:
Michael Hunger

Constructor Summary
PartialNodeEntityInstantiator(NodeEntityInstantiator delegate, javax.persistence.EntityManagerFactory entityManagerFactory)
           
 
Method Summary
<T extends NodeBacked>
T
createEntityFromState(org.neo4j.graphdb.Node n, Class<T> entityClass)
          Takes the JPA id stored in the "FOREIGN_ID" property of the node for a EntityManager.find(Class, Object) operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PartialNodeEntityInstantiator

public PartialNodeEntityInstantiator(NodeEntityInstantiator delegate,
                                     javax.persistence.EntityManagerFactory entityManagerFactory)
Method Detail

createEntityFromState

public <T extends NodeBacked> T createEntityFromState(org.neo4j.graphdb.Node n,
                                                      Class<T> entityClass)
Takes the JPA id stored in the "FOREIGN_ID" property of the node for a EntityManager.find(Class, Object) operation. If the entity is found its instance is associated with the graph node and returned otherwise a new node entity instance for this node is created by the original EntityInstantiator.

Specified by:
createEntityFromState in interface org.springframework.data.persistence.EntityInstantiator<NodeBacked,org.neo4j.graphdb.Node>
Type Parameters:
T - generic type of the entity
Parameters:
n - Node to instantiate an entity for
entityClass - type of the entity
Returns:

Spring Data Graph

Copyright © 2011 SpringSource. All Rights Reserved.