|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.mapped.mapping.JavaTypeMapping
org.datanucleus.store.mapped.mapping.MultiMapping
org.datanucleus.store.mapped.mapping.MultiPersistableMapping
org.datanucleus.store.mapped.mapping.ReferenceMapping
public abstract class ReferenceMapping
Mapping for a "reference" type. This can be used for things like interfaces, or Object which are simply a reference to some specific (PersistenceCapable) class. This can be persisted in several ways (see "mappingStrategy") :-
| Field Summary | |
|---|---|
static int |
ID_MAPPING
Single column containing the "identity" of an object. |
protected static Localiser |
LOCALISER_MAPPED
Localiser for messages |
protected int |
mappingStrategy
Strategy for how the reference(s) are mapped. |
static int |
PER_IMPLEMENTATION_MAPPING
Each implementation has its own column(s) as a FK to the related table. |
static int |
XCALIA_MAPPING
Single column containing the Xcalia form of the "identity" of an object. |
| Fields inherited from class org.datanucleus.store.mapped.mapping.MultiMapping |
|---|
javaTypeMappings, numberOfDatastoreMappings |
| Fields inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping |
|---|
absFieldNumber, datastoreContainer, datastoreMappings, LOCALISER, mmd, referenceMapping, roleForMember, storeMgr, type |
| Constructor Summary | |
|---|---|
ReferenceMapping()
|
|
| Method Summary | |
|---|---|
Class |
getJavaType()
Accessor for the java type being mapped. |
String |
getJavaTypeForDatastoreMapping(int index)
Accessor for the java type represented by a particular datastore mapping. |
int |
getMappingNumberForValue(ExecutionContext ec,
Object value)
Convenience accessor for the number of the java type mapping where the passed value would be stored. |
int |
getMappingStrategy()
Accessor for the mapping strategy. |
Object |
getObject(ExecutionContext ec,
Object rs,
int[] pos)
Method to retrieve an object of this type from the ResultSet. |
protected Object |
getObjectForReferenceString(ExecutionContext ec,
String refString)
Method to convert a "reference string" into the associated object. |
protected String |
getReferenceStringForObject(ExecutionContext ec,
Object value)
Method to convert an object to be stored into a "reference string" to store. |
void |
initialize(AbstractMemberMetaData mmd,
DatastoreContainerObject container,
ClassLoaderResolver clr)
Initialize this JavaTypeMapping for the specified field/property. |
void |
insertPostProcessing(ObjectProvider sm)
Method executed just after the insert of the owning object, allowing any necessary action to this field and the object stored in it. |
void |
postFetch(ObjectProvider sm)
Method executed just after a fetch of the owning object, allowing any necessary action to this field and the object stored in it. |
void |
postInsert(ObjectProvider sm)
Method executed just after the insert of the owning object, allowing any necessary action to this field and the object stored in it. |
void |
postUpdate(ObjectProvider sm)
Method executed just afer any update of the owning object, allowing any necessary action to this field and the object stored in it. |
void |
preDelete(ObjectProvider sm)
Method executed just before the owning object is deleted, allowing tidying up of any relation information. |
protected void |
prepareDatastoreMapping(ClassLoaderResolver clr)
Convenience method to create the necessary columns to represent this reference in the datastore. |
void |
setObject(ExecutionContext ec,
Object ps,
int[] pos,
Object value,
ObjectProvider ownerSM,
int ownerFieldNumber)
Sets the specified positions in the PreparedStatement associated with this field, and value. |
| Methods inherited from class org.datanucleus.store.mapped.mapping.MultiPersistableMapping |
|---|
setObject |
| Methods inherited from class org.datanucleus.store.mapped.mapping.MultiMapping |
|---|
addJavaTypeMapping, getDatastoreMapping, getDatastoreMappings, getJavaTypeMapping, getNumberOfDatastoreMappings |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Localiser LOCALISER_MAPPED
public static final int PER_IMPLEMENTATION_MAPPING
public static final int ID_MAPPING
public static final int XCALIA_MAPPING
protected int mappingStrategy
| Constructor Detail |
|---|
public ReferenceMapping()
| Method Detail |
|---|
public void initialize(AbstractMemberMetaData mmd,
DatastoreContainerObject container,
ClassLoaderResolver clr)
initialize in class JavaTypeMappingmmd - AbstractMemberMetaData for the field to be mapped (if any)container - The datastore container storing this mapping (if any)clr - the ClassLoaderResolverpublic int getMappingStrategy()
protected void prepareDatastoreMapping(ClassLoaderResolver clr)
clr - The ClassLoaderResolverpublic String getJavaTypeForDatastoreMapping(int index)
getJavaTypeForDatastoreMapping in class JavaTypeMappingindex - requested datastore field index.
public int getMappingNumberForValue(ExecutionContext ec,
Object value)
getMappingNumberForValue in class MultiPersistableMappingec - ExecutionContextvalue - The value
public void setObject(ExecutionContext ec,
Object ps,
int[] pos,
Object value,
ObjectProvider ownerSM,
int ownerFieldNumber)
setObject in class MultiPersistableMappingec - the ExecutionContextps - a datastore object that executes statements in the databasepos - The position(s) of the PreparedStatement to populatevalue - the value stored in this fieldownerSM - the owner StateManagerownerFieldNumber - the owner absolute field number
public Object getObject(ExecutionContext ec,
Object rs,
int[] pos)
getObject in class MultiPersistableMappingec - ExecutionContextrs - The ResultSetpos - The parameter positions
public Class getJavaType()
JavaTypeMapping
getJavaType in class JavaTypeMapping
protected String getReferenceStringForObject(ExecutionContext ec,
Object value)
ec - ExecutionContextvalue - The object
protected Object getObjectForReferenceString(ExecutionContext ec,
String refString)
ec - execution contextrefString - The reference string
public void postFetch(ObjectProvider sm)
postFetch in interface MappingCallbackssm - StateManager for the owner.public void insertPostProcessing(ObjectProvider sm)
insertPostProcessing in interface MappingCallbackssm - StateManager for the ownerpublic void postInsert(ObjectProvider sm)
postInsert in interface MappingCallbackssm - StateManager for the ownerpublic void postUpdate(ObjectProvider sm)
postUpdate in interface MappingCallbackssm - StateManager for the ownerpublic void preDelete(ObjectProvider sm)
preDelete in interface MappingCallbackssm - StateManager for the owner
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||