Spring Data Neo4j

org.springframework.data.neo4j.fieldaccess
Class DefaultEntityState<STATE>

java.lang.Object
  extended by org.springframework.data.neo4j.fieldaccess.DefaultEntityState<STATE>
All Implemented Interfaces:
EntityState<STATE>
Direct Known Subclasses:
CrossStoreNodeEntityState, NodeEntityState, RelationshipEntityState

public abstract class DefaultEntityState<STATE>
extends Object
implements EntityState<STATE>

Since:
12.09.2010
Author:
Michael Hunger

Field Summary
protected  Object entity
           
protected static org.slf4j.Logger log
           
protected  Neo4jPersistentEntity<?> persistentEntity
           
protected  Class<?> type
           
 
Constructor Summary
DefaultEntityState(STATE underlyingState, Object entity, Class<?> type, DelegatingFieldAccessorFactory delegatingFieldAccessorFactory, Neo4jPersistentEntity<?> persistentEntity)
           
 
Method Summary
protected  FieldAccessor accessorFor(Neo4jPersistentProperty property)
           
abstract  void createAndAssignState()
          callback for creating and initializing an initial state TODO will be internal implementation detail of persist
 Object getDefaultValue(Neo4jPersistentProperty property)
           
 Object getEntity()
           
protected  Object getIdFromEntity()
           
 Neo4jPersistentEntity<?> getPersistentEntity()
           
 STATE getPersistentState()
           
 Object getValue(Field field, MappingPolicy mappingPolicy)
           
 Object getValue(Neo4jPersistentProperty property, MappingPolicy mappingPolicy)
           
 boolean hasPersistentState()
           
 boolean isWritable(Neo4jPersistentProperty property)
           
protected  Neo4jPersistentProperty property(Field field)
           
 void setPersistentState(STATE state)
           
 Object setValue(Field field, Object newVal, MappingPolicy mappingPolicy)
           
 Object setValue(Neo4jPersistentProperty property, Object newVal, MappingPolicy mappingPolicy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.data.neo4j.core.EntityState
persist
 

Field Detail

entity

protected final Object entity

type

protected final Class<?> type

log

protected static final org.slf4j.Logger log

persistentEntity

protected final Neo4jPersistentEntity<?> persistentEntity
Constructor Detail

DefaultEntityState

public DefaultEntityState(STATE underlyingState,
                          Object entity,
                          Class<?> type,
                          DelegatingFieldAccessorFactory delegatingFieldAccessorFactory,
                          Neo4jPersistentEntity<?> persistentEntity)
Method Detail

createAndAssignState

public abstract void createAndAssignState()
Description copied from interface: EntityState
callback for creating and initializing an initial state TODO will be internal implementation detail of persist

Specified by:
createAndAssignState in interface EntityState<STATE>

getEntity

public Object getEntity()
Specified by:
getEntity in interface EntityState<STATE>

setPersistentState

public void setPersistentState(STATE state)
Specified by:
setPersistentState in interface EntityState<STATE>

hasPersistentState

public boolean hasPersistentState()
Specified by:
hasPersistentState in interface EntityState<STATE>

getPersistentState

public STATE getPersistentState()
Specified by:
getPersistentState in interface EntityState<STATE>

getPersistentEntity

public Neo4jPersistentEntity<?> getPersistentEntity()
Specified by:
getPersistentEntity in interface EntityState<STATE>

isWritable

public boolean isWritable(Neo4jPersistentProperty property)
Specified by:
isWritable in interface EntityState<STATE>
Returns:
true if the field can be written

getValue

public Object getValue(Neo4jPersistentProperty property,
                       MappingPolicy mappingPolicy)
Specified by:
getValue in interface EntityState<STATE>
Returns:
value of the property either from the state and/or the entity

getValue

public Object getValue(Field field,
                       MappingPolicy mappingPolicy)
Specified by:
getValue in interface EntityState<STATE>
Returns:
value of the field either from the state and/or the entity

setValue

public Object setValue(Field field,
                       Object newVal,
                       MappingPolicy mappingPolicy)
Specified by:
setValue in interface EntityState<STATE>
Returns:
sets the value in the entity and/or the state

setValue

public Object setValue(Neo4jPersistentProperty property,
                       Object newVal,
                       MappingPolicy mappingPolicy)
Specified by:
setValue in interface EntityState<STATE>

getDefaultValue

public Object getDefaultValue(Neo4jPersistentProperty property)
Specified by:
getDefaultValue in interface EntityState<STATE>
Returns:
a default value for the given field by its FieldAccessor or null if none is provided.

property

protected Neo4jPersistentProperty property(Field field)

accessorFor

protected FieldAccessor accessorFor(Neo4jPersistentProperty property)

getIdFromEntity

protected Object getIdFromEntity()

Spring Data Neo4j

Copyright © 2013 SpringSource. All Rights Reserved.