public interface StateManager
Persistable
classes and DataNucleus.
It contains the methods used by Persistable
instances to delegate behavior to DataNucleus.
Each managed Persistable
instance contains a reference to a StateManager
.
In principle, a StateManager
might manage one or multiple instances of Persistable
instances.
In reality we only ever manage a single Persistable
instance here, see StateManagerImpl.
Modifier and Type | Method and Description |
---|---|
default boolean |
getBooleanField(Persistable pc,
int field,
boolean currentValue)
Return the value for the field.
|
default byte |
getByteField(Persistable pc,
int field,
byte currentValue)
Return the value for the field.
|
default char |
getCharField(Persistable pc,
int field,
char currentValue)
Return the value for the field.
|
default double |
getDoubleField(Persistable pc,
int field,
double currentValue)
Return the value for the field.
|
ExecutionContextReference |
getExecutionContextReference()
Return the
ExecutionContext that owns this instance. |
default float |
getFloatField(Persistable pc,
int field,
float currentValue)
Return the value for the field.
|
default int |
getIntField(Persistable pc,
int field,
int currentValue)
Return the value for the field.
|
default long |
getLongField(Persistable pc,
int field,
long currentValue)
Return the value for the field.
|
default Object |
getObjectField(Persistable pc,
int field,
Object currentValue)
Return the value for the field.
|
Object |
getObjectId(Persistable pc)
Return the object representing the identity of the calling instance.
|
default short |
getShortField(Persistable pc,
int field,
short currentValue)
Return the value for the field.
|
default String |
getStringField(Persistable pc,
int field,
String currentValue)
Return the value for the field.
|
Object |
getTransactionalObjectId(Persistable pc)
Return the object representing the identity of the calling instance.
|
Object |
getVersion(Persistable pc)
Return the object representing the version of the calling instance.
|
boolean |
isDeleted(Persistable pc)
Tests whether this object has been deleted.
|
boolean |
isDirty(Persistable pc)
Tests whether this object is dirty.
|
boolean |
isLoaded(Persistable pc,
int field)
Return
true if the field is cached in the calling instance. |
boolean |
isNew(Persistable pc)
Tests whether this object has been newly made persistent.
|
boolean |
isPersistent(Persistable pc)
Tests whether this object is persistent.
|
boolean |
isTransactional(Persistable pc)
Tests whether this object is transactional.
|
void |
makeDirty(Persistable pc,
String fieldName)
Mark the associated
Persistable field dirty. |
void |
preSerialize(Persistable pc)
Guarantee that the serializable transactional and persistent fields are loaded into the instance.
|
void |
providedBooleanField(Persistable pc,
int field,
boolean currentValue)
The value of the field requested to be provided to the
StateManager . |
void |
providedByteField(Persistable pc,
int field,
byte currentValue)
The value of the field requested to be provided to the
StateManager . |
void |
providedCharField(Persistable pc,
int field,
char currentValue)
The value of the field requested to be provided to the
StateManager . |
void |
providedDoubleField(Persistable pc,
int field,
double currentValue)
The value of the field requested to be provided to the
StateManager . |
void |
providedFloatField(Persistable pc,
int field,
float currentValue)
The value of the field requested to be provided to the
StateManager . |
void |
providedIntField(Persistable pc,
int field,
int currentValue)
The value of the field requested to be provided to the
StateManager . |
void |
providedLongField(Persistable pc,
int field,
long currentValue)
The value of the field requested to be provided to the
StateManager . |
void |
providedObjectField(Persistable pc,
int field,
Object currentValue)
The value of the field requested to be provided to the
StateManager . |
void |
providedShortField(Persistable pc,
int field,
short currentValue)
The value of the field requested to be provided to the
StateManager . |
void |
providedStringField(Persistable pc,
int field,
String currentValue)
The value of the field requested to be provided to the
StateManager . |
boolean |
replacingBooleanField(Persistable pc,
int field)
The replacement value of the field in the calling instance.
|
byte |
replacingByteField(Persistable pc,
int field)
The replacement value of the field in the calling instance.
|
char |
replacingCharField(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.
|
double |
replacingDoubleField(Persistable pc,
int field)
The replacement value of the field in the calling instance.
|
byte |
replacingFlags(Persistable pc)
The owning
StateManager uses this method to supply the value of the flags to the
Persistable instance. |
float |
replacingFloatField(Persistable pc,
int field)
The replacement value of the field in the calling instance.
|
int |
replacingIntField(Persistable pc,
int field)
The replacement value of the field in the calling instance.
|
long |
replacingLongField(Persistable pc,
int field)
The replacement value of the field in the calling instance.
|
Object |
replacingObjectField(Persistable pc,
int field)
The replacement value of the field in the calling instance.
|
short |
replacingShortField(Persistable pc,
int field)
The replacement value of the field in the calling instance.
|
StateManager |
replacingStateManager(Persistable pc,
StateManager sm)
Replace the current value of
dnStateManager . |
String |
replacingStringField(Persistable pc,
int field)
The replacement value of the field in the calling instance.
|
void |
setBooleanField(Persistable pc,
int field,
boolean currentValue,
boolean newValue)
Mark the field as modified by the user.
|
void |
setByteField(Persistable pc,
int field,
byte currentValue,
byte newValue)
Mark the field as modified by the user.
|
void |
setCharField(Persistable pc,
int field,
char currentValue,
char newValue)
Mark the field as modified by the user.
|
void |
setDoubleField(Persistable pc,
int field,
double currentValue,
double newValue)
Mark the field as modified by the user.
|
void |
setFloatField(Persistable pc,
int field,
float currentValue,
float newValue)
Mark the field as modified by the user.
|
void |
setIntField(Persistable pc,
int field,
int currentValue,
int newValue)
Mark the field as modified by the user.
|
void |
setLongField(Persistable pc,
int field,
long currentValue,
long newValue)
Mark the field as modified by the user.
|
void |
setObjectField(Persistable pc,
int field,
Object currentValue,
Object newValue)
Mark the field as modified by the user.
|
void |
setShortField(Persistable pc,
int field,
short currentValue,
short newValue)
Mark the field as modified by the user.
|
void |
setStringField(Persistable pc,
int field,
String currentValue,
String newValue)
Mark the field as modified by the user.
|
ExecutionContextReference getExecutionContextReference()
ExecutionContext
that owns this instance.ExecutionContext
that owns this instancebyte replacingFlags(Persistable pc)
StateManager
uses this method to supply the value of the flags to the
Persistable
instance.pc
- the calling Persistable
instancednFlags
to be stored in the Persistable
instanceStateManager replacingStateManager(Persistable pc, StateManager sm)
dnStateManager
.
This method is called by the Persistable
whenever dnReplaceStateManager
is
called and there is already an owning StateManager
. This is a security precaution to
ensure that the owning StateManager
is the only source of any change to its reference in
the Persistable
.
pc
- the calling Persistable
instancesm
- the proposed new value for the dnStateManager
dnStateManager
boolean isDirty(Persistable pc)
true
.
Transient nontransactional instances return false
.
pc
- the calling Persistable
instancetrue
if this instance has been modified in the current transaction.Persistable.dnMakeDirty(String fieldName)
boolean isTransactional(Persistable pc)
true
. These instances include transient instances made transactional as a result of being
the target of a makeTransactional
method 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
.
pc
- the calling Persistable
instancetrue
if this instance is transactional.boolean isPersistent(Persistable pc)
true
.
Transient instances return false
.
pc
- the calling Persistable
instancetrue
if this instance is persistent.boolean isNew(Persistable pc)
true
.
Transient instances return false
.
pc
- the calling Persistable
instancetrue
if this instance was made persistent in the current transaction.boolean isDeleted(Persistable pc)
true
.
Transient instances return false
.
pc
- the calling Persistable
instancetrue
if this instance was deleted in the current transaction.void makeDirty(Persistable pc, String fieldName)
Persistable
field dirty.
The StateManager
will 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.
pc
- the calling Persistable
instancefieldName
- the name of the fieldObject getObjectId(Persistable pc)
pc
- the calling Persistable
instanceObject getTransactionalObjectId(Persistable pc)
pc
- the calling Persistable
instanceObject getVersion(Persistable pc)
pc
- the calling Persistable
instanceboolean isLoaded(Persistable pc, int field)
true
if the field is cached in the calling instance.pc
- the calling Persistable
instancefield
- the field numbervoid preSerialize(Persistable pc)
dnPreSerialize
method prior to serialization of the
instance.pc
- the calling Persistable
instancedefault boolean getBooleanField(Persistable pc, int field, boolean currentValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fielddefault char getCharField(Persistable pc, int field, char currentValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fielddefault byte getByteField(Persistable pc, int field, byte currentValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fielddefault short getShortField(Persistable pc, int field, short currentValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fielddefault int getIntField(Persistable pc, int field, int currentValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fielddefault long getLongField(Persistable pc, int field, long currentValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fielddefault float getFloatField(Persistable pc, int field, float currentValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fielddefault double getDoubleField(Persistable pc, int field, double currentValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fielddefault String getStringField(Persistable pc, int field, String currentValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fielddefault Object getObjectField(Persistable pc, int field, Object currentValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldvoid setBooleanField(Persistable pc, int field, boolean currentValue, boolean newValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldnewValue
- the proposed new value of the fieldvoid setCharField(Persistable pc, int field, char currentValue, char newValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldnewValue
- the proposed new value of the fieldvoid setByteField(Persistable pc, int field, byte currentValue, byte newValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldnewValue
- the proposed new value of the fieldvoid setShortField(Persistable pc, int field, short currentValue, short newValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldnewValue
- the proposed new value of the fieldvoid setIntField(Persistable pc, int field, int currentValue, int newValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldnewValue
- the proposed new value of the fieldvoid setLongField(Persistable pc, int field, long currentValue, long newValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldnewValue
- the proposed new value of the fieldvoid setFloatField(Persistable pc, int field, float currentValue, float newValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldnewValue
- the proposed new value of the fieldvoid setDoubleField(Persistable pc, int field, double currentValue, double newValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldnewValue
- the proposed new value of the fieldvoid setStringField(Persistable pc, int field, String currentValue, String newValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldnewValue
- the proposed new value of the fieldvoid setObjectField(Persistable pc, int field, Object currentValue, Object newValue)
pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldnewValue
- the proposed new value of the fieldvoid providedBooleanField(Persistable pc, int field, boolean currentValue)
StateManager
.pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldvoid providedCharField(Persistable pc, int field, char currentValue)
StateManager
.pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldvoid providedByteField(Persistable pc, int field, byte currentValue)
StateManager
.pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldvoid providedShortField(Persistable pc, int field, short currentValue)
StateManager
.pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldvoid providedIntField(Persistable pc, int field, int currentValue)
StateManager
.pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldvoid providedLongField(Persistable pc, int field, long currentValue)
StateManager
.pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldvoid providedFloatField(Persistable pc, int field, float currentValue)
StateManager
.pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldvoid providedDoubleField(Persistable pc, int field, double currentValue)
StateManager
.pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldvoid providedStringField(Persistable pc, int field, String currentValue)
StateManager
.pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldvoid providedObjectField(Persistable pc, int field, Object currentValue)
StateManager
.pc
- the calling Persistable
instancefield
- the field numbercurrentValue
- the current value of the fieldboolean replacingBooleanField(Persistable pc, int field)
pc
- the calling Persistable
instancefield
- the field numberchar replacingCharField(Persistable pc, int field)
pc
- the calling Persistable
instancefield
- the field numberbyte replacingByteField(Persistable pc, int field)
pc
- the calling Persistable
instancefield
- the field numbershort replacingShortField(Persistable pc, int field)
pc
- the calling Persistable
instancefield
- the field numberint replacingIntField(Persistable pc, int field)
pc
- the calling Persistable
instancefield
- the field numberlong replacingLongField(Persistable pc, int field)
pc
- the calling Persistable
instancefield
- the field numberfloat replacingFloatField(Persistable pc, int field)
pc
- the calling Persistable
instancefield
- the field numberdouble replacingDoubleField(Persistable pc, int field)
pc
- the calling Persistable
instancefield
- the field numberString replacingStringField(Persistable pc, int field)
pc
- the calling Persistable
instancefield
- the field numberObject replacingObjectField(Persistable pc, int field)
pc
- the calling Persistable
instancefield
- the field numberObject[] replacingDetachedState(Detachable pc, Object[] state)
pc
- the calling Detachable
instancestate
- the current value of the detached stateCopyright © 2020. All rights reserved.