- 
- All Known Subinterfaces:
 DNStateManager<T>
- All Known Implementing Classes:
 ReferentialStateManagerImpl,StateManagerImpl
public interface StateManagerThis interface is the point of contact between managed instances ofPersistableclasses and DataNucleus. It contains the methods used byPersistableinstances to delegate behavior to DataNucleus.Each managed
Persistableinstance contains a reference to aStateManager. In principle, aStateManagermight manage one or multiple instances ofPersistableinstances. In reality we only ever manage a singlePersistableinstance here, see StateManagerImpl. 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleangetBooleanField(Persistable pc, int field, boolean currentValue)Return the value for the field.default bytegetByteField(Persistable pc, int field, byte currentValue)Return the value for the field.default chargetCharField(Persistable pc, int field, char currentValue)Return the value for the field.default doublegetDoubleField(Persistable pc, int field, double currentValue)Return the value for the field.ExecutionContextReferencegetExecutionContextReference()Return theExecutionContextthat owns this instance.default floatgetFloatField(Persistable pc, int field, float currentValue)Return the value for the field.default intgetIntField(Persistable pc, int field, int currentValue)Return the value for the field.default longgetLongField(Persistable pc, int field, long currentValue)Return the value for the field.default ObjectgetObjectField(Persistable pc, int field, Object currentValue)Return the value for the field.ObjectgetObjectId(Persistable pc)Return the object representing the identity of the calling instance.default shortgetShortField(Persistable pc, int field, short currentValue)Return the value for the field.default StringgetStringField(Persistable pc, int field, String currentValue)Return the value for the field.ObjectgetTransactionalObjectId(Persistable pc)Return the object representing the identity of the calling instance.ObjectgetVersion(Persistable pc)Return the object representing the version of the calling instance.booleanisDeleted(Persistable pc)Tests whether this object has been deleted.booleanisDirty(Persistable pc)Tests whether this object is dirty.booleanisLoaded(Persistable pc, int field)Returntrueif the field is cached in the calling instance.booleanisNew(Persistable pc)Tests whether this object has been newly made persistent.booleanisPersistent(Persistable pc)Tests whether this object is persistent.booleanisTransactional(Persistable pc)Tests whether this object is transactional.voidmakeDirty(Persistable pc, String fieldName)Mark the associatedPersistablefield dirty.voidpreSerialize(Persistable pc)Guarantee that the serializable transactional and persistent fields are loaded into the instance.voidprovidedBooleanField(Persistable pc, int field, boolean currentValue)The value of the field requested to be provided to theStateManager.voidprovidedByteField(Persistable pc, int field, byte currentValue)The value of the field requested to be provided to theStateManager.voidprovidedCharField(Persistable pc, int field, char currentValue)The value of the field requested to be provided to theStateManager.voidprovidedDoubleField(Persistable pc, int field, double currentValue)The value of the field requested to be provided to theStateManager.voidprovidedFloatField(Persistable pc, int field, float currentValue)The value of the field requested to be provided to theStateManager.voidprovidedIntField(Persistable pc, int field, int currentValue)The value of the field requested to be provided to theStateManager.voidprovidedLongField(Persistable pc, int field, long currentValue)The value of the field requested to be provided to theStateManager.voidprovidedObjectField(Persistable pc, int field, Object currentValue)The value of the field requested to be provided to theStateManager.voidprovidedShortField(Persistable pc, int field, short currentValue)The value of the field requested to be provided to theStateManager.voidprovidedStringField(Persistable pc, int field, String currentValue)The value of the field requested to be provided to theStateManager.booleanreplacingBooleanField(Persistable pc, int field)The replacement value of the field in the calling instance.bytereplacingByteField(Persistable pc, int field)The replacement value of the field in the calling instance.charreplacingCharField(Persistable pc, int field)The replacement value of the field in the calling instance.Object[]replacingDetachedState(Detachable pc, Object[] state)The replacement value of the detached state in the calling instance.doublereplacingDoubleField(Persistable pc, int field)The replacement value of the field in the calling instance.bytereplacingFlags(Persistable pc)The owningStateManageruses this method to supply the value of the flags to thePersistableinstance.floatreplacingFloatField(Persistable pc, int field)The replacement value of the field in the calling instance.intreplacingIntField(Persistable pc, int field)The replacement value of the field in the calling instance.longreplacingLongField(Persistable pc, int field)The replacement value of the field in the calling instance.ObjectreplacingObjectField(Persistable pc, int field)The replacement value of the field in the calling instance.shortreplacingShortField(Persistable pc, int field)The replacement value of the field in the calling instance.StateManagerreplacingStateManager(Persistable pc, StateManager sm)Replace the current value ofdnStateManager.StringreplacingStringField(Persistable pc, int field)The replacement value of the field in the calling instance.voidsetBooleanField(Persistable pc, int field, boolean currentValue, boolean newValue)Mark the field as modified by the user.voidsetByteField(Persistable pc, int field, byte currentValue, byte newValue)Mark the field as modified by the user.voidsetCharField(Persistable pc, int field, char currentValue, char newValue)Mark the field as modified by the user.voidsetDoubleField(Persistable pc, int field, double currentValue, double newValue)Mark the field as modified by the user.voidsetFloatField(Persistable pc, int field, float currentValue, float newValue)Mark the field as modified by the user.voidsetIntField(Persistable pc, int field, int currentValue, int newValue)Mark the field as modified by the user.voidsetLongField(Persistable pc, int field, long currentValue, long newValue)Mark the field as modified by the user.voidsetObjectField(Persistable pc, int field, Object currentValue, Object newValue)Mark the field as modified by the user.voidsetShortField(Persistable pc, int field, short currentValue, short newValue)Mark the field as modified by the user.voidsetStringField(Persistable pc, int field, String currentValue, String newValue)Mark the field as modified by the user. 
 - 
 
- 
- 
Method Detail
- 
getExecutionContextReference
ExecutionContextReference getExecutionContextReference()
Return theExecutionContextthat owns this instance.- Returns:
 - the 
ExecutionContextthat owns this instance 
 
- 
replacingFlags
byte replacingFlags(Persistable pc)
The owningStateManageruses this method to supply the value of the flags to thePersistableinstance.- Parameters:
 pc- the callingPersistableinstance- Returns:
 - the value of 
dnFlagsto be stored in thePersistableinstance 
 
- 
replacingStateManager
StateManager replacingStateManager(Persistable pc, StateManager sm)
Replace the current value ofdnStateManager.This method is called by the
PersistablewheneverdnReplaceStateManageris called and there is already an owningStateManager. This is a security precaution to ensure that the owningStateManageris the only source of any change to its reference in thePersistable.- Parameters:
 pc- the callingPersistableinstancesm- the proposed new value for thednStateManager- Returns:
 - the new value for the 
dnStateManager 
 
- 
isDirty
boolean isDirty(Persistable pc)
Tests whether this object is dirty. Instances that have been modified, deleted, or newly made persistent in the current transaction returntrue.Transient nontransactional instances return
false.- Parameters:
 pc- the callingPersistableinstance- Returns:
 trueif this instance has been modified in the current transaction.- See Also:
 Persistable.dnMakeDirty(String fieldName)
 
- 
isTransactional
boolean isTransactional(Persistable pc)
Tests whether this object is transactional. Instances that respect transaction boundaries returntrue. These instances include transient instances made transactional as a result of being the target of amakeTransactionalmethod call; newly made persistent or deleted persistent instances; persistent instances read in data store transactions; and persistent instances modified in optimistic transactions.Transient nontransactional instances return
false.- Parameters:
 pc- the callingPersistableinstance- Returns:
 trueif this instance is transactional.
 
- 
isPersistent
boolean isPersistent(Persistable pc)
Tests whether this object is persistent. Instances whose state is stored in the data store returntrue.Transient instances return
false.- Parameters:
 pc- the callingPersistableinstance- Returns:
 trueif this instance is persistent.
 
- 
isNew
boolean isNew(Persistable pc)
Tests whether this object has been newly made persistent. Instances that have been made persistent in the current transaction returntrue.Transient instances return
false.- Parameters:
 pc- the callingPersistableinstance- Returns:
 trueif this instance was made persistent in the current transaction.
 
- 
isDeleted
boolean isDeleted(Persistable pc)
Tests whether this object has been deleted. Instances that have been deleted in the current transaction returntrue.Transient instances return
false.- Parameters:
 pc- the callingPersistableinstance- Returns:
 trueif this instance was deleted in the current transaction.
 
- 
makeDirty
void makeDirty(Persistable pc, String fieldName)
Mark the associatedPersistablefield dirty.The
StateManagerwill make a copy of the field so it can be restored if needed later, and then mark the field as modified in the current transaction.- Parameters:
 pc- the callingPersistableinstancefieldName- the name of the field
 
- 
getObjectId
Object getObjectId(Persistable pc)
Return the object representing the identity of the calling instance. If the identity is being changed in the current transaction, this method returns the identity as of the beginning of the transaction.- Parameters:
 pc- the callingPersistableinstance- Returns:
 - the object representing the identity of the calling instance
 
 
- 
getTransactionalObjectId
Object getTransactionalObjectId(Persistable pc)
Return the object representing the identity of the calling instance. If the identity is being changed in the current transaction, this method returns the current identity as changed in the transaction.- Parameters:
 pc- the callingPersistableinstance- Returns:
 - the object representing the identity of the calling instance
 
 
- 
getVersion
Object getVersion(Persistable pc)
Return the object representing the version of the calling instance.- Parameters:
 pc- the callingPersistableinstance- Returns:
 - the object representing the version of the calling instance
 
 
- 
isLoaded
boolean isLoaded(Persistable pc, int field)
Returntrueif the field is cached in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - whether the field is cached in the calling instance
 
 
- 
preSerialize
void preSerialize(Persistable pc)
Guarantee that the serializable transactional and persistent fields are loaded into the instance. This method is called by the generateddnPreSerializemethod prior to serialization of the instance.- Parameters:
 pc- the callingPersistableinstance
 
- 
getBooleanField
default boolean getBooleanField(Persistable pc, int field, boolean currentValue)
Return the value for the field.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
 - the new value for the field
 
 
- 
getCharField
default char getCharField(Persistable pc, int field, char currentValue)
Return the value for the field.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
 - the new value for the field
 
 
- 
getByteField
default byte getByteField(Persistable pc, int field, byte currentValue)
Return the value for the field.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
 - the new value for the field
 
 
- 
getShortField
default short getShortField(Persistable pc, int field, short currentValue)
Return the value for the field.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
 - the new value for the field
 
 
- 
getIntField
default int getIntField(Persistable pc, int field, int currentValue)
Return the value for the field.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
 - the new value for the field
 
 
- 
getLongField
default long getLongField(Persistable pc, int field, long currentValue)
Return the value for the field.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
 - the new value for the field
 
 
- 
getFloatField
default float getFloatField(Persistable pc, int field, float currentValue)
Return the value for the field.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
 - the new value for the field
 
 
- 
getDoubleField
default double getDoubleField(Persistable pc, int field, double currentValue)
Return the value for the field.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
 - the new value for the field
 
 
- 
getStringField
default String getStringField(Persistable pc, int field, String currentValue)
Return the value for the field.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
 - the new value for the field
 
 
- 
getObjectField
default Object getObjectField(Persistable pc, int field, Object currentValue)
Return the value for the field.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
 - the new value for the field
 
 
- 
setBooleanField
void setBooleanField(Persistable pc, int field, boolean currentValue, boolean newValue)
Mark the field as modified by the user.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
 
- 
setCharField
void setCharField(Persistable pc, int field, char currentValue, char newValue)
Mark the field as modified by the user.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
 
- 
setByteField
void setByteField(Persistable pc, int field, byte currentValue, byte newValue)
Mark the field as modified by the user.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
 
- 
setShortField
void setShortField(Persistable pc, int field, short currentValue, short newValue)
Mark the field as modified by the user.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
 
- 
setIntField
void setIntField(Persistable pc, int field, int currentValue, int newValue)
Mark the field as modified by the user.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
 
- 
setLongField
void setLongField(Persistable pc, int field, long currentValue, long newValue)
Mark the field as modified by the user.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
 
- 
setFloatField
void setFloatField(Persistable pc, int field, float currentValue, float newValue)
Mark the field as modified by the user.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
 
- 
setDoubleField
void setDoubleField(Persistable pc, int field, double currentValue, double newValue)
Mark the field as modified by the user.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
 
- 
setStringField
void setStringField(Persistable pc, int field, String currentValue, String newValue)
Mark the field as modified by the user.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
 
- 
setObjectField
void setObjectField(Persistable pc, int field, Object currentValue, Object newValue)
Mark the field as modified by the user.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
 
- 
providedBooleanField
void providedBooleanField(Persistable pc, int field, boolean currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field
 
- 
providedCharField
void providedCharField(Persistable pc, int field, char currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field
 
- 
providedByteField
void providedByteField(Persistable pc, int field, byte currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field
 
- 
providedShortField
void providedShortField(Persistable pc, int field, short currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field
 
- 
providedIntField
void providedIntField(Persistable pc, int field, int currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field
 
- 
providedLongField
void providedLongField(Persistable pc, int field, long currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field
 
- 
providedFloatField
void providedFloatField(Persistable pc, int field, float currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field
 
- 
providedDoubleField
void providedDoubleField(Persistable pc, int field, double currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field
 
- 
providedStringField
void providedStringField(Persistable pc, int field, String currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field
 
- 
providedObjectField
void providedObjectField(Persistable pc, int field, Object currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
 pc- the callingPersistableinstancefield- the field numbercurrentValue- the current value of the field
 
- 
replacingBooleanField
boolean replacingBooleanField(Persistable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - the new value for the field
 
 
- 
replacingCharField
char replacingCharField(Persistable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - the new value for the field
 
 
- 
replacingByteField
byte replacingByteField(Persistable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - the new value for the field
 
 
- 
replacingShortField
short replacingShortField(Persistable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - the new value for the field
 
 
- 
replacingIntField
int replacingIntField(Persistable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - the new value for the field
 
 
- 
replacingLongField
long replacingLongField(Persistable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - the new value for the field
 
 
- 
replacingFloatField
float replacingFloatField(Persistable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - the new value for the field
 
 
- 
replacingDoubleField
double replacingDoubleField(Persistable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - the new value for the field
 
 
- 
replacingStringField
String replacingStringField(Persistable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - the new value for the field
 
 
- 
replacingObjectField
Object replacingObjectField(Persistable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
 pc- the callingPersistableinstancefield- the field number- Returns:
 - the new value for the field
 
 
- 
replacingDetachedState
Object[] replacingDetachedState(Detachable pc, Object[] state)
The replacement value of the detached state in the calling instance.- Parameters:
 pc- the callingDetachableinstancestate- the current value of the detached state- Returns:
 - the replacement value for the detached state
 
 
 - 
 
 -