Spring Data Graph

org.springframework.data.neo4j.support.typerepresentation
Class IndexingRelationshipTypeRepresentationStrategy

java.lang.Object
  extended by org.springframework.data.neo4j.support.typerepresentation.IndexingRelationshipTypeRepresentationStrategy
All Implemented Interfaces:
RelationshipTypeRepresentationStrategy, TypeRepresentationStrategy<org.neo4j.graphdb.Relationship,RelationshipBacked>

public class IndexingRelationshipTypeRepresentationStrategy
extends Object
implements RelationshipTypeRepresentationStrategy


Field Summary
static String INDEX_KEY
           
static String INDEX_NAME
           
static String TYPE_PROPERTY_NAME
           
 
Constructor Summary
IndexingRelationshipTypeRepresentationStrategy(org.neo4j.graphdb.GraphDatabaseService graphDb, org.springframework.data.persistence.EntityInstantiator<RelationshipBacked,org.neo4j.graphdb.Relationship> relationshipEntityInstantiator)
           
 
Method Summary
 long count(Class<? extends RelationshipBacked> entityClass)
           
<U extends RelationshipBacked>
U
createEntity(org.neo4j.graphdb.Relationship state)
          Instantiate the entity given its state.
<U extends RelationshipBacked>
U
createEntity(org.neo4j.graphdb.Relationship state, Class<U> type)
          Instantiate the entity given its state.
<U extends RelationshipBacked>
org.neo4j.helpers.collection.ClosableIterable<U>
findAll(Class<U> clazz)
           
 Class<? extends RelationshipBacked> getJavaType(org.neo4j.graphdb.Relationship relationship)
           
 void postEntityCreation(org.neo4j.graphdb.Relationship state, Class<? extends RelationshipBacked> type)
          Callback for setting up and/or storing type information after creation.
 void preEntityRemoval(org.neo4j.graphdb.Relationship state)
          Callback for cleaning up type information before removal.
<U extends RelationshipBacked>
U
projectEntity(org.neo4j.graphdb.Relationship state, Class<U> type)
          Instantiate the entity of the given type, with the given state as backing state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDEX_NAME

public static final String INDEX_NAME
See Also:
Constant Field Values

TYPE_PROPERTY_NAME

public static final String TYPE_PROPERTY_NAME
See Also:
Constant Field Values

INDEX_KEY

public static final String INDEX_KEY
See Also:
Constant Field Values
Constructor Detail

IndexingRelationshipTypeRepresentationStrategy

public IndexingRelationshipTypeRepresentationStrategy(org.neo4j.graphdb.GraphDatabaseService graphDb,
                                                      org.springframework.data.persistence.EntityInstantiator<RelationshipBacked,org.neo4j.graphdb.Relationship> relationshipEntityInstantiator)
Method Detail

postEntityCreation

public void postEntityCreation(org.neo4j.graphdb.Relationship state,
                               Class<? extends RelationshipBacked> type)
Description copied from interface: TypeRepresentationStrategy
Callback for setting up and/or storing type information after creation.

Specified by:
postEntityCreation in interface TypeRepresentationStrategy<org.neo4j.graphdb.Relationship,RelationshipBacked>
Parameters:
state - Backing state of entity being created
type - Type of entity being created

findAll

public <U extends RelationshipBacked> org.neo4j.helpers.collection.ClosableIterable<U> findAll(Class<U> clazz)
Specified by:
findAll in interface TypeRepresentationStrategy<org.neo4j.graphdb.Relationship,RelationshipBacked>
Parameters:
clazz - Type whose instances should be iterated over
Returns:
lazy Iterable over all instances of the given type

count

public long count(Class<? extends RelationshipBacked> entityClass)
Specified by:
count in interface TypeRepresentationStrategy<org.neo4j.graphdb.Relationship,RelationshipBacked>
Returns:
number of instances of this class contained in the graph

getJavaType

public Class<? extends RelationshipBacked> getJavaType(org.neo4j.graphdb.Relationship relationship)
Specified by:
getJavaType in interface TypeRepresentationStrategy<org.neo4j.graphdb.Relationship,RelationshipBacked>
Returns:
java type that of the node entity of this node

preEntityRemoval

public void preEntityRemoval(org.neo4j.graphdb.Relationship state)
Description copied from interface: TypeRepresentationStrategy
Callback for cleaning up type information before removal. If state does not have any state associated, doesn't do anything.

Specified by:
preEntityRemoval in interface TypeRepresentationStrategy<org.neo4j.graphdb.Relationship,RelationshipBacked>
Parameters:
state - Backing state of entity being removed

createEntity

public <U extends RelationshipBacked> U createEntity(org.neo4j.graphdb.Relationship state)
Description copied from interface: TypeRepresentationStrategy
Instantiate the entity given its state. The type of the entity is inferred by the strategy from the state.

Specified by:
createEntity in interface TypeRepresentationStrategy<org.neo4j.graphdb.Relationship,RelationshipBacked>
Type Parameters:
U - Helper parameter for castless use
Parameters:
state - Backing state of entity to be instantiated
Returns:
Entity instance

createEntity

public <U extends RelationshipBacked> U createEntity(org.neo4j.graphdb.Relationship state,
                                                     Class<U> type)
Description copied from interface: TypeRepresentationStrategy
Instantiate the entity given its state. The type of the desired entity is also specified. If the type is not compatible with what the strategy can infer from the state, IllegalArgumentException is thrown.

Specified by:
createEntity in interface TypeRepresentationStrategy<org.neo4j.graphdb.Relationship,RelationshipBacked>
Parameters:
state - Backing state of entity to be instantiated
type - Type of entity to be instantiated
Returns:
Entity instance

projectEntity

public <U extends RelationshipBacked> U projectEntity(org.neo4j.graphdb.Relationship state,
                                                      Class<U> type)
Description copied from interface: TypeRepresentationStrategy
Instantiate the entity of the given type, with the given state as backing state. No checking is done by the strategy.

Specified by:
projectEntity in interface TypeRepresentationStrategy<org.neo4j.graphdb.Relationship,RelationshipBacked>
Parameters:
state - Backing state of entity to be instantiated
type - Type of entity to be instantiated
Returns:
Entity instance.

Spring Data Graph

Copyright © 2011 SpringSource. All Rights Reserved.