org.datanucleus.store
Interface ObjectProvider

All Known Implementing Classes:
ObjectProviderImpl

public interface ObjectProvider

Provides fields. TODO Provide proper javadoc telling people what this is actually for, and documenting each method.


Method Summary
 void addEmbeddedOwner(ObjectProvider ownerSM, int ownerFieldNumber)
          Method to register an owner StateManager with this embedded/serialised object.
 void copyFieldsFromObject(java.lang.Object pc, int[] fieldNumbers)
          Convenience method to update our object with the field values from the passed object.
 void deletePersistent()
           
 AbstractClassMetaData getClassMetaData()
           
 java.lang.String[] getDirtyFieldNames()
          Accessor for the names of the fields that are dirty.
 int[] getDirtyFieldNumbers()
          Accessor for the field numbers of all dirty fields.
 ObjectProvider[] getEmbeddedOwners()
           
 ExecutionContext getExecutionContext()
           
 java.lang.Object getExternalObjectId()
           
 java.lang.Object getInternalObjectId()
           
 LifeCycleState getLifecycleState()
           
 java.lang.Object getObject()
          TODO remove this
 boolean isEmbedded()
           
 boolean isInserting()
           
 void loadUnloadedFields()
          Fetch from the database all fields that are not currently loaded regardless of whether they are in the current fetch group or not.
 void makeDirty(int field)
          Marks the given field dirty.
 java.lang.Object provideField(int fieldNumber)
           
 void provideFields(int[] fieldNumbers, FieldManager fm)
           
 void replaceField(int fieldNumber, java.lang.Object value)
          Method to change the value of the specified field.
 void replaceFields(int[] fieldNumbers, FieldManager fm)
           
 void replaceNonLoadedFields(int[] fieldNumbers, FieldManager fm)
           
 void setAssociatedValue(java.lang.Object key, java.lang.Object value)
          Method to set an associated value stored with this object.
 java.lang.String toPrintableID()
           
 java.lang.Object wrapSCOField(int fieldNumber, java.lang.Object value, boolean forInsert, boolean forUpdate, boolean replaceFieldIfChanged)
          TODO should not need this method from the store perspective Method to create a new SCO wrapper for the specified field.
 

Method Detail

getClassMetaData

AbstractClassMetaData getClassMetaData()

replaceField

void replaceField(int fieldNumber,
                  java.lang.Object value)
Method to change the value of the specified field. This will not make the field dirty

Parameters:
fieldNumber - (absolute) field number of the field
value - The new value.

replaceFields

void replaceFields(int[] fieldNumbers,
                   FieldManager fm)

replaceNonLoadedFields

void replaceNonLoadedFields(int[] fieldNumbers,
                            FieldManager fm)

provideFields

void provideFields(int[] fieldNumbers,
                   FieldManager fm)

provideField

java.lang.Object provideField(int fieldNumber)

getExecutionContext

ExecutionContext getExecutionContext()

toPrintableID

java.lang.String toPrintableID()

wrapSCOField

java.lang.Object wrapSCOField(int fieldNumber,
                              java.lang.Object value,
                              boolean forInsert,
                              boolean forUpdate,
                              boolean replaceFieldIfChanged)
TODO should not need this method from the store perspective Method to create a new SCO wrapper for the specified field. If the field is not a SCO field will just return the value.

Parameters:
fieldNumber - The field number
value - The value to initialise the wrapper with (if any)
forInsert - Whether the creation of any wrapper should insert this value into the datastore
forUpdate - Whether the creation of any wrapper should update the datastore with this value
replaceFieldIfChanged - Whether to replace the field in the object if wrapping the value
Returns:
The wrapper (or original value if not wrappable)

getObject

java.lang.Object getObject()
TODO remove this

Returns:

getInternalObjectId

java.lang.Object getInternalObjectId()

getExternalObjectId

java.lang.Object getExternalObjectId()

setAssociatedValue

void setAssociatedValue(java.lang.Object key,
                        java.lang.Object value)
Method to set an associated value stored with this object. This is for a situation such as in ORM where this object can have an "external" foreign-key provided by an owning object (e.g 1-N uni relation and this is the element with no knowledge of the owner, so the associated value is the FK value).

Parameters:
key - Key for the value
value - The associated value

loadUnloadedFields

void loadUnloadedFields()
Fetch from the database all fields that are not currently loaded regardless of whether they are in the current fetch group or not. Called by lifecycle transitions.


getDirtyFieldNumbers

int[] getDirtyFieldNumbers()
Accessor for the field numbers of all dirty fields.

Returns:
Absolute field numbers of the dirty fields in this instance.

getDirtyFieldNames

java.lang.String[] getDirtyFieldNames()
Accessor for the names of the fields that are dirty.

Returns:
Names of the dirty fields

makeDirty

void makeDirty(int field)
Marks the given field dirty.

Parameters:
field - The no of field to mark as dirty.

deletePersistent

void deletePersistent()

isInserting

boolean isInserting()

getEmbeddedOwners

ObjectProvider[] getEmbeddedOwners()

getLifecycleState

LifeCycleState getLifecycleState()

addEmbeddedOwner

void addEmbeddedOwner(ObjectProvider ownerSM,
                      int ownerFieldNumber)
Method to register an owner StateManager with this embedded/serialised object.

Parameters:
ownerSM - The owning State Manager.
ownerFieldNumber - The field number in the owner that the embedded/serialised object is stored as

isEmbedded

boolean isEmbedded()

copyFieldsFromObject

void copyFieldsFromObject(java.lang.Object pc,
                          int[] fieldNumbers)
Convenience method to update our object with the field values from the passed object. Objects need to be of the same type, and the other object should not have a StateManager.

Parameters:
pc - The object that we should copy fields from


Copyright © 2010. All Rights Reserved.