|
||||||||||
| 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.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 |
|---|
datastoreContainer, datastoreMappings, LOCALISER, mmd, referenceMapping, roleForMember, storeMgr, type |
| Constructor Summary | |
|---|---|
ReferenceMapping()
|
|
| Method Summary | |
|---|---|
java.lang.Class |
getJavaType()
Accessor for the java type being mapped. |
java.lang.String |
getJavaTypeForDatastoreMapping(int index)
Accessor for the java type represented by a particular datastore mapping. |
int |
getMappingNumberForValue(ExecutionContext ec,
java.lang.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. |
java.lang.Object |
getObject(ExecutionContext ec,
java.lang.Object rs,
int[] pos)
Method to retrieve an object of this type from the ResultSet. |
protected java.lang.Object |
getObjectForReferenceString(ExecutionContext ec,
java.lang.String refString)
Method to convert a "reference string" into the associated object. |
protected java.lang.String |
getReferenceStringForObject(ExecutionContext ec,
java.lang.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,
java.lang.Object ps,
int[] pos,
java.lang.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.MultiMapping |
|---|
addJavaTypeMapping, getDatastoreMapping, getDatastoreMappings, getJavaTypeMapping, getNumberOfDatastoreMappings, setObject |
| Methods inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping |
|---|
addDatastoreMapping, equals, failureMessage, getBoolean, getByte, getChar, getColumnMetaDataForMember, getDatastoreContainer, getDouble, getFloat, getInt, getLong, getMemberMetaData, getObject, getReferenceMapping, getRoleForMember, getShort, getString, getType, getValueForDatastoreMapping, hashCode, hasSimpleDatastoreRepresentation, includeInFetchStatement, includeInInsertStatement, includeInUpdateStatement, initialize, isNullable, isSerialised, setBoolean, setByte, setChar, setDatastoreContainer, setDouble, setFloat, setInt, setLong, setMemberMetaData, setReferenceMapping, setRoleForMember, setShort, setString |
| 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 java.lang.String getJavaTypeForDatastoreMapping(int index)
getJavaTypeForDatastoreMapping in class JavaTypeMappingindex - requested datastore field index.
public int getMappingNumberForValue(ExecutionContext ec,
java.lang.Object value)
getMappingNumberForValue in class MultiMappingec - ObjectManagervalue - The value
public void setObject(ExecutionContext ec,
java.lang.Object ps,
int[] pos,
java.lang.Object value,
ObjectProvider ownerSM,
int ownerFieldNumber)
setObject in class MultiMappingec - the ObjectManagerps - 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 java.lang.Object getObject(ExecutionContext ec,
java.lang.Object rs,
int[] pos)
getObject in class MultiMappingec - Object Managerrs - The ResultSetpos - The parameter positions
public java.lang.Class getJavaType()
JavaTypeMapping
getJavaType in class JavaTypeMapping
protected java.lang.String getReferenceStringForObject(ExecutionContext ec,
java.lang.Object value)
ec - ObjectManagervalue - The object
protected java.lang.Object getObjectForReferenceString(ExecutionContext ec,
java.lang.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 | |||||||||