datanucleus-core
datanucleus-core copied to clipboard
Enhancement contract : use single PC object per StateManager
The JDO bytecode contract allows implementations to manage multiple PC objects with 1 StateManager
. DataNucleus has never done that and really cannot see the benefit. Consequently if we were to update the bytecode contract to drop the extra Persistable
argument from many StateManager
calls then we could have slightly cleaner code.
Methods in StateManager that could have this treatment
boolean isDirty();
boolean isTransactional();
boolean isPersistent();
boolean isNew();
boolean isDeleted();
boolean isLoaded(int field);
void makeDirty(String fieldName);
Object getObjectId();
Object getTransactionalObjectId();
Object getVersion();
void preSerialize();
byte replacingFlags();
StateManager replacingStateManager(StateManager sm);
Called by Persistable set (check/mediate)
void setBooleanField(int field, boolean currentValue, boolean newValue);
void setCharField(int field, char currentValue, char newValue);
void setByteField(int field, byte currentValue, byte newValue);
void setShortField(int field, short currentValue, short newValue);
void setIntField(int field, int currentValue, int newValue);
void setLongField(int field, long currentValue, long newValue);
void setFloatField(int field, float currentValue, float newValue);
void setDoubleField(int field, double currentValue, double newValue);
void setStringField(int field, String currentValue, String newValue);
void setObjectField(int field, Object currentValue, Object newValue);
Called by Persistable.replaceField(...)
boolean replacingBooleanField(int field);
char replacingCharField(int field);
byte replacingByteField(int field);
short replacingShortField(int field);
int replacingIntField(int field);
long replacingLongField(int field);
float replacingFloatField(int field);
double replacingDoubleField(int field);
String replacingStringField(int field);
Object replacingObjectField(int field);
Called by Persistable.provideField(...)
void providedBooleanField(int field, boolean currentValue);
void providedCharField(int field, char currentValue);
void providedByteField(int field, byte currentValue);
void providedShortField(int field, short currentValue);
void providedIntField(int field, int currentValue);
void providedLongField(int field, long currentValue);
void providedFloatField(int field, float currentValue);
void providedDoubleField(int field, double currentValue);
void providedStringField(int field, String currentValue);
void providedObjectField(int field, Object currentValue);
The only current use of the extra argument is that it allows us to disconnect any cloned objects that are cloned to point to the same StateManager
, and hence we can immediately disconnect any clones.
Low priority since it doesn't give significant benefits.