Spring Data Neo4j

org.springframework.data.neo4j.support.typerepresentation
Class AbstractIndexingTypeRepresentationStrategy<S extends org.neo4j.graphdb.PropertyContainer>

java.lang.Object
  extended by org.springframework.data.neo4j.support.typerepresentation.AbstractIndexingTypeRepresentationStrategy<S>
All Implemented Interfaces:
TypeRepresentationStrategy<S>
Direct Known Subclasses:
IndexingNodeTypeRepresentationStrategy, IndexingRelationshipTypeRepresentationStrategy

public abstract class AbstractIndexingTypeRepresentationStrategy<S extends org.neo4j.graphdb.PropertyContainer>
extends Object
implements TypeRepresentationStrategy<S>


Field Summary
protected  GraphDatabase graphDb
           
static String INDEX_KEY
           
protected  String INDEX_NAME
           
protected  IndexProvider indexProvider
           
static String TYPE_PROPERTY_NAME
           
protected  org.springframework.data.neo4j.support.typerepresentation.EntityTypeCache typeCache
           
 
Constructor Summary
AbstractIndexingTypeRepresentationStrategy(GraphDatabase graphDb, IndexProvider indexProvider, String indexName, Class<? extends org.neo4j.graphdb.PropertyContainer> clazz, Class<? extends Annotation> typeEntityClass)
           
 
Method Summary
protected  void addToTypesIndex(S relationshipOrNode, Class<?> entityClass)
           
 long count(Class<?> entityClass)
           
<U> org.neo4j.helpers.collection.ClosableIterable<S>
findAll(Class<U> clazz)
           
<U> Class<U>
getJavaType(S propertyContainer)
           
 org.neo4j.graphdb.index.Index<S> getTypesIndex()
           
 void postEntityCreation(S state, Class<?> type)
          Callback for setting up and/or storing type information after creation.
 void preEntityRemoval(S state)
          Callback for cleaning up type information before removal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

INDEX_NAME

protected String INDEX_NAME

graphDb

protected final GraphDatabase graphDb

typeCache

protected final org.springframework.data.neo4j.support.typerepresentation.EntityTypeCache typeCache

indexProvider

protected final IndexProvider indexProvider
Constructor Detail

AbstractIndexingTypeRepresentationStrategy

public AbstractIndexingTypeRepresentationStrategy(GraphDatabase graphDb,
                                                  IndexProvider indexProvider,
                                                  String indexName,
                                                  Class<? extends org.neo4j.graphdb.PropertyContainer> clazz,
                                                  Class<? extends Annotation> typeEntityClass)
Method Detail

getTypesIndex

public org.neo4j.graphdb.index.Index<S> getTypesIndex()

postEntityCreation

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

Specified by:
postEntityCreation in interface TypeRepresentationStrategy<S extends org.neo4j.graphdb.PropertyContainer>
Parameters:
state - Backing state of entity being created
type - Type of entity being created

count

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

preEntityRemoval

public void preEntityRemoval(S 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<S extends org.neo4j.graphdb.PropertyContainer>
Parameters:
state - Backing state of entity being removed

findAll

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

getJavaType

public <U> Class<U> getJavaType(S propertyContainer)
Specified by:
getJavaType in interface TypeRepresentationStrategy<S extends org.neo4j.graphdb.PropertyContainer>
Returns:
java type that of the node entity of this node

addToTypesIndex

protected void addToTypesIndex(S relationshipOrNode,
                               Class<?> entityClass)

Spring Data Neo4j

Copyright © 2011 SpringSource. All Rights Reserved.