Interface StateManager
-
public interface StateManagerThis interface is the point of contact between managed instances ofPersistenceCapableclasses and the JDO implementation. It contains the methods used byPersistenceCapableinstances to delegate behavior to the JDO implementation.Each managed
PersistenceCapableinstance contains a reference to aStateManager. AStateManagermight manage one or multiple instances ofPersistenceCapableinstances, at the choice of the implementation.- Version:
- 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleangetBooleanField(PersistenceCapable pc, int field, boolean currentValue)Return the value for the field.bytegetByteField(PersistenceCapable pc, int field, byte currentValue)Return the value for the field.chargetCharField(PersistenceCapable pc, int field, char currentValue)Return the value for the field.doublegetDoubleField(PersistenceCapable pc, int field, double currentValue)Return the value for the field.floatgetFloatField(PersistenceCapable pc, int field, float currentValue)Return the value for the field.intgetIntField(PersistenceCapable pc, int field, int currentValue)Return the value for the field.longgetLongField(PersistenceCapable pc, int field, long currentValue)Return the value for the field.ObjectgetObjectField(PersistenceCapable pc, int field, Object currentValue)Return the value for the field.ObjectgetObjectId(PersistenceCapable pc)Return the object representing the JDO identity of the calling instance.PersistenceManagergetPersistenceManager(PersistenceCapable pc)Return thePersistenceManagerthat owns this instance.shortgetShortField(PersistenceCapable pc, int field, short currentValue)Return the value for the field.StringgetStringField(PersistenceCapable pc, int field, String currentValue)Return the value for the field.ObjectgetTransactionalObjectId(PersistenceCapable pc)Return the object representing the JDO identity of the calling instance.ObjectgetVersion(PersistenceCapable pc)Return the object representing the version of the calling instance.booleanisDeleted(PersistenceCapable pc)Tests whether this object has been deleted.booleanisDirty(PersistenceCapable pc)Tests whether this object is dirty.booleanisLoaded(PersistenceCapable pc, int field)Returntrueif the field is cached in the calling instance.booleanisNew(PersistenceCapable pc)Tests whether this object has been newly made persistent.booleanisPersistent(PersistenceCapable pc)Tests whether this object is persistent.booleanisTransactional(PersistenceCapable pc)Tests whether this object is transactional.voidmakeDirty(PersistenceCapable pc, String fieldName)Mark the associatedPersistenceCapablefield dirty.voidpreSerialize(PersistenceCapable pc)Guarantee that the serializable transactional and persistent fields are loaded into the instance.voidprovidedBooleanField(PersistenceCapable pc, int field, boolean currentValue)The value of the field requested to be provided to theStateManager.voidprovidedByteField(PersistenceCapable pc, int field, byte currentValue)The value of the field requested to be provided to theStateManager.voidprovidedCharField(PersistenceCapable pc, int field, char currentValue)The value of the field requested to be provided to theStateManager.voidprovidedDoubleField(PersistenceCapable pc, int field, double currentValue)The value of the field requested to be provided to theStateManager.voidprovidedFloatField(PersistenceCapable pc, int field, float currentValue)The value of the field requested to be provided to theStateManager.voidprovidedIntField(PersistenceCapable pc, int field, int currentValue)The value of the field requested to be provided to theStateManager.voidprovidedLongField(PersistenceCapable pc, int field, long currentValue)The value of the field requested to be provided to theStateManager.voidprovidedObjectField(PersistenceCapable pc, int field, Object currentValue)The value of the field requested to be provided to theStateManager.voidprovidedShortField(PersistenceCapable pc, int field, short currentValue)The value of the field requested to be provided to theStateManager.voidprovidedStringField(PersistenceCapable pc, int field, String currentValue)The value of the field requested to be provided to theStateManager.booleanreplacingBooleanField(PersistenceCapable pc, int field)The replacement value of the field in the calling instance.bytereplacingByteField(PersistenceCapable pc, int field)The replacement value of the field in the calling instance.charreplacingCharField(PersistenceCapable 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(PersistenceCapable pc, int field)The replacement value of the field in the calling instance.bytereplacingFlags(PersistenceCapable pc)The owningStateManageruses this method to supply the value of the flags to thePersistenceCapableinstance.floatreplacingFloatField(PersistenceCapable pc, int field)The replacement value of the field in the calling instance.intreplacingIntField(PersistenceCapable pc, int field)The replacement value of the field in the calling instance.longreplacingLongField(PersistenceCapable pc, int field)The replacement value of the field in the calling instance.ObjectreplacingObjectField(PersistenceCapable pc, int field)The replacement value of the field in the calling instance.shortreplacingShortField(PersistenceCapable pc, int field)The replacement value of the field in the calling instance.StateManagerreplacingStateManager(PersistenceCapable pc, StateManager sm)Replace the current value ofjdoStateManager.StringreplacingStringField(PersistenceCapable pc, int field)The replacement value of the field in the calling instance.voidsetBooleanField(PersistenceCapable pc, int field, boolean currentValue, boolean newValue)Mark the field as modified by the user.voidsetByteField(PersistenceCapable pc, int field, byte currentValue, byte newValue)Mark the field as modified by the user.voidsetCharField(PersistenceCapable pc, int field, char currentValue, char newValue)Mark the field as modified by the user.voidsetDoubleField(PersistenceCapable pc, int field, double currentValue, double newValue)Mark the field as modified by the user.voidsetFloatField(PersistenceCapable pc, int field, float currentValue, float newValue)Mark the field as modified by the user.voidsetIntField(PersistenceCapable pc, int field, int currentValue, int newValue)Mark the field as modified by the user.voidsetLongField(PersistenceCapable pc, int field, long currentValue, long newValue)Mark the field as modified by the user.voidsetObjectField(PersistenceCapable pc, int field, Object currentValue, Object newValue)Mark the field as modified by the user.voidsetShortField(PersistenceCapable pc, int field, short currentValue, short newValue)Mark the field as modified by the user.voidsetStringField(PersistenceCapable pc, int field, String currentValue, String newValue)Mark the field as modified by the user.
-
-
-
Method Detail
-
replacingFlags
byte replacingFlags(PersistenceCapable pc)
The owningStateManageruses this method to supply the value of the flags to thePersistenceCapableinstance.- Parameters:
pc- the callingPersistenceCapableinstance- Returns:
- the value of
jdoFlagsto be stored in thePersistenceCapableinstance
-
replacingStateManager
StateManager replacingStateManager(PersistenceCapable pc, StateManager sm)
Replace the current value ofjdoStateManager.This method is called by the
PersistenceCapablewheneverjdoReplaceStateManageris 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 thePersistenceCapable.- Parameters:
pc- the callingPersistenceCapableinstancesm- the proposed new value for thejdoStateManager- Returns:
- the new value for the
jdoStateManager
-
isDirty
boolean isDirty(PersistenceCapable 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 callingPersistenceCapableinstance- Returns:
trueif this instance has been modified in the current transaction.- See Also:
PersistenceCapable.jdoMakeDirty(String fieldName)
-
isTransactional
boolean isTransactional(PersistenceCapable 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 callingPersistenceCapableinstance- Returns:
trueif this instance is transactional.
-
isPersistent
boolean isPersistent(PersistenceCapable pc)
Tests whether this object is persistent. Instances whose state is stored in the data store returntrue.Transient instances return
false.- Parameters:
pc- the callingPersistenceCapableinstance- Returns:
trueif this instance is persistent.- See Also:
PersistenceManager.makePersistent(Object pc)
-
isNew
boolean isNew(PersistenceCapable 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 callingPersistenceCapableinstance- Returns:
trueif this instance was made persistent in the current transaction.- See Also:
PersistenceManager.makePersistent(Object pc)
-
isDeleted
boolean isDeleted(PersistenceCapable 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 callingPersistenceCapableinstance- Returns:
trueif this instance was deleted in the current transaction.- See Also:
PersistenceManager.deletePersistent(Object pc)
-
getPersistenceManager
PersistenceManager getPersistenceManager(PersistenceCapable pc)
Return thePersistenceManagerthat owns this instance.- Parameters:
pc- the callingPersistenceCapableinstance- Returns:
- the
PersistenceManagerthat owns this instance
-
makeDirty
void makeDirty(PersistenceCapable pc, String fieldName)
Mark the associatedPersistenceCapablefield 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 callingPersistenceCapableinstancefieldName- the name of the field
-
getObjectId
Object getObjectId(PersistenceCapable pc)
Return the object representing the JDO identity of the calling instance. If the JDO identity is being changed in the current transaction, this method returns the identity as of the beginning of the transaction.- Parameters:
pc- the callingPersistenceCapableinstance- Returns:
- the object representing the JDO identity of the calling instance
-
getTransactionalObjectId
Object getTransactionalObjectId(PersistenceCapable pc)
Return the object representing the JDO identity of the calling instance. If the JDO identity is being changed in the current transaction, this method returns the current identity as changed in the transaction.- Parameters:
pc- the callingPersistenceCapableinstance- Returns:
- the object representing the JDO identity of the calling instance
-
getVersion
Object getVersion(PersistenceCapable pc)
Return the object representing the version of the calling instance.- Parameters:
pc- the callingPersistenceCapableinstance- Returns:
- the object representing the version of the calling instance
- Since:
- 2.0
-
isLoaded
boolean isLoaded(PersistenceCapable pc, int field)
Returntrueif the field is cached in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field number- Returns:
- whether the field is cached in the calling instance
-
preSerialize
void preSerialize(PersistenceCapable pc)
Guarantee that the serializable transactional and persistent fields are loaded into the instance. This method is called by the generatedjdoPreSerializemethod prior to serialization of the instance.- Parameters:
pc- the callingPersistenceCapableinstance
-
getBooleanField
boolean getBooleanField(PersistenceCapable pc, int field, boolean currentValue)
Return the value for the field.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
- the new value for the field
-
getCharField
char getCharField(PersistenceCapable pc, int field, char currentValue)
Return the value for the field.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
- the new value for the field
-
getByteField
byte getByteField(PersistenceCapable pc, int field, byte currentValue)
Return the value for the field.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
- the new value for the field
-
getShortField
short getShortField(PersistenceCapable pc, int field, short currentValue)
Return the value for the field.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
- the new value for the field
-
getIntField
int getIntField(PersistenceCapable pc, int field, int currentValue)
Return the value for the field.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
- the new value for the field
-
getLongField
long getLongField(PersistenceCapable pc, int field, long currentValue)
Return the value for the field.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
- the new value for the field
-
getFloatField
float getFloatField(PersistenceCapable pc, int field, float currentValue)
Return the value for the field.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
- the new value for the field
-
getDoubleField
double getDoubleField(PersistenceCapable pc, int field, double currentValue)
Return the value for the field.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
- the new value for the field
-
getStringField
String getStringField(PersistenceCapable pc, int field, String currentValue)
Return the value for the field.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
- the new value for the field
-
getObjectField
Object getObjectField(PersistenceCapable pc, int field, Object currentValue)
Return the value for the field.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field- Returns:
- the new value for the field
-
setBooleanField
void setBooleanField(PersistenceCapable pc, int field, boolean currentValue, boolean newValue)
Mark the field as modified by the user.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
-
setCharField
void setCharField(PersistenceCapable pc, int field, char currentValue, char newValue)
Mark the field as modified by the user.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
-
setByteField
void setByteField(PersistenceCapable pc, int field, byte currentValue, byte newValue)
Mark the field as modified by the user.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
-
setShortField
void setShortField(PersistenceCapable pc, int field, short currentValue, short newValue)
Mark the field as modified by the user.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
-
setIntField
void setIntField(PersistenceCapable pc, int field, int currentValue, int newValue)
Mark the field as modified by the user.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
-
setLongField
void setLongField(PersistenceCapable pc, int field, long currentValue, long newValue)
Mark the field as modified by the user.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
-
setFloatField
void setFloatField(PersistenceCapable pc, int field, float currentValue, float newValue)
Mark the field as modified by the user.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
-
setDoubleField
void setDoubleField(PersistenceCapable pc, int field, double currentValue, double newValue)
Mark the field as modified by the user.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
-
setStringField
void setStringField(PersistenceCapable pc, int field, String currentValue, String newValue)
Mark the field as modified by the user.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
-
setObjectField
void setObjectField(PersistenceCapable pc, int field, Object currentValue, Object newValue)
Mark the field as modified by the user.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the fieldnewValue- the proposed new value of the field
-
providedBooleanField
void providedBooleanField(PersistenceCapable pc, int field, boolean currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field
-
providedCharField
void providedCharField(PersistenceCapable pc, int field, char currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field
-
providedByteField
void providedByteField(PersistenceCapable pc, int field, byte currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field
-
providedShortField
void providedShortField(PersistenceCapable pc, int field, short currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field
-
providedIntField
void providedIntField(PersistenceCapable pc, int field, int currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field
-
providedLongField
void providedLongField(PersistenceCapable pc, int field, long currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field
-
providedFloatField
void providedFloatField(PersistenceCapable pc, int field, float currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field
-
providedDoubleField
void providedDoubleField(PersistenceCapable pc, int field, double currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field
-
providedStringField
void providedStringField(PersistenceCapable pc, int field, String currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field
-
providedObjectField
void providedObjectField(PersistenceCapable pc, int field, Object currentValue)
The value of the field requested to be provided to theStateManager.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field numbercurrentValue- the current value of the field
-
replacingBooleanField
boolean replacingBooleanField(PersistenceCapable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field number- Returns:
- the new value for the field
-
replacingCharField
char replacingCharField(PersistenceCapable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field number- Returns:
- the new value for the field
-
replacingByteField
byte replacingByteField(PersistenceCapable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field number- Returns:
- the new value for the field
-
replacingShortField
short replacingShortField(PersistenceCapable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field number- Returns:
- the new value for the field
-
replacingIntField
int replacingIntField(PersistenceCapable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field number- Returns:
- the new value for the field
-
replacingLongField
long replacingLongField(PersistenceCapable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field number- Returns:
- the new value for the field
-
replacingFloatField
float replacingFloatField(PersistenceCapable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field number- Returns:
- the new value for the field
-
replacingDoubleField
double replacingDoubleField(PersistenceCapable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field number- Returns:
- the new value for the field
-
replacingStringField
String replacingStringField(PersistenceCapable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- the field number- Returns:
- the new value for the field
-
replacingObjectField
Object replacingObjectField(PersistenceCapable pc, int field)
The replacement value of the field in the calling instance.- Parameters:
pc- the callingPersistenceCapableinstancefield- 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
- Since:
- 2.0
-
-