public interface DataManager
| Modifier and Type | Interface and Description |
|---|---|
static class |
DataManager.ChangeKind
Kinds of changes for collections and maps
|
static interface |
DataManager.TrackingHandler
Callback interface for objects that need to be notified when modifications are made on managed entities
|
static class |
DataManager.TrackingType
Types of tracked events
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Reset all currently tracked objects
|
void |
copyProxyState(java.lang.Object target,
java.lang.Object source)
Copy the proxy state (fields __initialized__ and __detachedState__) from source to target
|
void |
copyUid(java.lang.Object target,
java.lang.Object source)
Copy the uid field (annotated with
Uid) from source to target |
boolean |
defineProxy(java.lang.Object target,
java.lang.Object source)
Define the target object as a proxy for the source entity
|
java.lang.String |
getCacheKey(java.lang.Object entity)
Return a unique key for the entity to be used in a local cache
|
java.lang.String |
getDetachedState(java.lang.Object entity)
Return the persistent detached state of an entity (private field name __detachedState__)
|
java.lang.Object |
getId(java.lang.Object entity)
Return the persistent id of an entity (field annotated with
Id) ? |
java.lang.String |
getIdPropertyName(java.lang.Object entity)
Name of the id field for the entity
|
java.lang.Object |
getPropertyValue(java.lang.Object entity,
java.lang.String name)
Return the value of the property for the specified entity instance
|
java.util.Map<java.lang.String,java.lang.Object> |
getPropertyValues(java.lang.Object entity,
boolean excludeVersion,
boolean includeReadOnly)
Return a map of property values for the specified entity instance
|
java.util.Map<java.lang.String,java.lang.Object> |
getPropertyValues(java.lang.Object entity,
boolean excludeIdUid,
boolean excludeVersion,
boolean includeReadOnly)
Return a map of property values for the specified entity instance
|
java.lang.String |
getUid(java.lang.Object entity)
Get the uid field (annotated with
Uid) for the entity
Note that the data manager implementation is allowed to generate a reasonable uid value from other fields
if no uid field is present |
java.lang.String |
getUidPropertyName(java.lang.Object entity)
Name of the uid field for the entity
|
java.lang.Object |
getVersion(java.lang.Object entity)
Return the version (field annotated with
Version) for an entity |
java.lang.String |
getVersionPropertyName(java.lang.Object entity)
Name of the version field for the entity
|
boolean |
hasIdProperty(java.lang.Object entity)
Has the entity an id field ?
|
boolean |
hasProperty(java.lang.Object entity,
java.lang.String name)
Return the value of the property for the specified entity instance
|
boolean |
hasVersionProperty(java.lang.Object entity)
Has the entity a version field (annotated with
Version) ? |
void |
initProxy(java.lang.Object dest,
java.lang.Object id,
boolean initialized,
java.lang.String detachedState)
Init state of a proxy object
|
boolean |
isDeepDirtyEntity(java.lang.Object entity)
Is the entity graph dirty (any object in the graph of this entity has been modified since last received from server) ?
|
boolean |
isDirty()
Is the data manager dirty (any managed entity instance has been modified since last received from server) ?
|
boolean |
isDirtyEntity(java.lang.Object entity)
Is the entity instance dirty (modified since last received from server) ?
|
boolean |
isEntity(java.lang.Object object)
Is the object an entity (i.e. annotated with
Entity) ? |
boolean |
isInitialized(java.lang.Object entity)
Is the entity initialized (field __initialized__ true) ?
|
boolean |
isLazyProperty(java.lang.Object entity,
java.lang.String name)
Is the specified property lazy ?
|
<T> T |
newInstance(java.lang.Object source,
java.lang.Class<T> cast)
Create an empty instance of the same class as the source
|
void |
notifyDirtyChange(boolean oldDirty,
boolean dirty)
Notify listeners that the dirty state of this data manager has changed
Called by dirty checking
|
void |
notifyEntityDirtyChange(java.lang.Object entity,
boolean oldDirtyEntity,
boolean newDirtyEntity)
Notify listeners that the dirty state of the specified has changed
|
void |
setLazyProperty(java.lang.Object entity,
java.lang.String name)
Define a property as lazy
|
void |
setPropertyValue(java.lang.Object entity,
java.lang.String name,
java.lang.Object value)
Set the value of the property for the specified entity instance
|
void |
setTrackingHandler(DataManager.TrackingHandler trackingHandler)
Register a handler that will be notified when any managed entity is modified
|
void |
startTracking(java.lang.Object previous,
java.lang.Object parent)
Start tracking for the specified object / parent
|
void |
stopTracking(java.lang.Object previous,
java.lang.Object parent)
Stop tracking for the specified object / parent
|
boolean isEntity(java.lang.Object object)
Entity) ?object - objectjava.lang.Object getId(java.lang.Object entity)
Id) ?entity - objectboolean hasIdProperty(java.lang.Object entity)
entity - objectjava.lang.String getIdPropertyName(java.lang.Object entity)
entity - objectjava.lang.String getDetachedState(java.lang.Object entity)
entity - objectvoid initProxy(java.lang.Object dest,
java.lang.Object id,
boolean initialized,
java.lang.String detachedState)
dest - proxy objectid - proxy idinitialized - is initializeddetachedState - detached stateboolean defineProxy(java.lang.Object target,
java.lang.Object source)
target - target objectsource - source entityvoid copyProxyState(java.lang.Object target,
java.lang.Object source)
target - target objectsource - source entityvoid copyUid(java.lang.Object target,
java.lang.Object source)
Uid) from source to targettarget - target objectsource - source entityjava.lang.Object getVersion(java.lang.Object entity)
Version) for an entityentity - entityboolean hasVersionProperty(java.lang.Object entity)
Version) ?entity - objectjava.lang.String getVersionPropertyName(java.lang.Object entity)
entity - objectjava.lang.String getUid(java.lang.Object entity)
Uid) for the entity
Note that the data manager implementation is allowed to generate a reasonable uid value from other fields
if no uid field is presententity - objectjava.lang.String getUidPropertyName(java.lang.Object entity)
entity - objectboolean hasProperty(java.lang.Object entity,
java.lang.String name)
entity - object instancename - property namejava.util.Map<java.lang.String,java.lang.Object> getPropertyValues(java.lang.Object entity,
boolean excludeIdUid,
boolean excludeVersion,
boolean includeReadOnly)
entity - object instanceexcludeIdUid - true to exclude id and uid fields from the mapexcludeVersion - true to exclude version field from the mapincludeReadOnly - true to include readonly fields in the mapjava.util.Map<java.lang.String,java.lang.Object> getPropertyValues(java.lang.Object entity,
boolean excludeVersion,
boolean includeReadOnly)
entity - object instanceexcludeVersion - true to exclude version field from the mapincludeReadOnly - true to include readonly fields in the mapjava.lang.Object getPropertyValue(java.lang.Object entity,
java.lang.String name)
entity - object instancename - property namevoid setPropertyValue(java.lang.Object entity,
java.lang.String name,
java.lang.Object value)
entity - object instancename - property namevalue - property valueboolean isLazyProperty(java.lang.Object entity,
java.lang.String name)
Lazy or if the
server has returned an initialized valueentity - entity instancename - property namevoid setLazyProperty(java.lang.Object entity,
java.lang.String name)
entity - entity instancename - property namejava.lang.String getCacheKey(java.lang.Object entity)
entity - entity instanceboolean isInitialized(java.lang.Object entity)
entity - entity instanceboolean isDirty()
boolean isDirtyEntity(java.lang.Object entity)
boolean isDeepDirtyEntity(java.lang.Object entity)
<T> T newInstance(java.lang.Object source,
java.lang.Class<T> cast)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
T - expected typesource - source objectcast - expected typejava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionvoid setTrackingHandler(DataManager.TrackingHandler trackingHandler)
trackingHandler - tracking handlervoid startTracking(java.lang.Object previous,
java.lang.Object parent)
previous - previously existing object in the entity manager cache (null if no existing object)parent - parent object for collectionsvoid stopTracking(java.lang.Object previous,
java.lang.Object parent)
previous - previously existing object in the entity manager cache (null if no existing object)parent - parent object for collectionsvoid clear()
void notifyDirtyChange(boolean oldDirty,
boolean dirty)
oldDirty - old valuedirty - new valueDirtyCheckContextvoid notifyEntityDirtyChange(java.lang.Object entity,
boolean oldDirtyEntity,
boolean newDirtyEntity)
entity - entity instanceoldDirtyEntity - old valuenewDirtyEntity - new valueDirtyCheckContext