|
||||||||||
| 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(ObjectManager om,
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(ObjectManager om,
java.lang.Object rs,
int[] pos)
Method to retrieve an object of this type from the ResultSet. |
protected java.lang.Object |
getObjectForReferenceString(ObjectManager om,
java.lang.String refString)
Method to convert a "reference string" into the associated object. |
protected java.lang.String |
getReferenceStringForObject(ObjectManager om,
java.lang.Object value)
Method to convert an object to be stored into a "reference string" to store. |
java.lang.Object |
getSampleValue(ClassLoaderResolver clr)
Return a sample value of the mapping type to be used for internal evaluation of type/conversion. |
void |
initialize(AbstractMemberMetaData mmd,
DatastoreContainerObject container,
ClassLoaderResolver clr)
Initialize this JavaTypeMapping for the specified field/property. |
void |
insertPostProcessing(StateManager sm)
Hook so that we can handle any post-processing on the insert of a particular field. |
ScalarExpression |
newLiteral(QueryExpression qs,
java.lang.Object value)
Creates a literal from an value for use in TJDO-style JDOQL. |
ScalarExpression |
newScalarExpression(QueryExpression qs,
LogicSetExpression te)
Creates a expression from a field name/table. |
void |
postFetch(StateManager 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(StateManager 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(StateManager 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(StateManager 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(ObjectManager om,
java.lang.Object ps,
int[] pos,
java.lang.Object value,
StateManager 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, setDefault, 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(ObjectManager om,
java.lang.Object value)
getMappingNumberForValue in class MultiMappingom - ObjectManagervalue - The value
public void setObject(ObjectManager om,
java.lang.Object ps,
int[] pos,
java.lang.Object value,
StateManager ownerSM,
int ownerFieldNumber)
setObject in class MultiMappingom - 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(ObjectManager om,
java.lang.Object rs,
int[] pos)
getObject in class MultiMappingom - Object Managerrs - The ResultSetpos - The parameter positions
public java.lang.Class getJavaType()
JavaTypeMapping
getJavaType in class JavaTypeMappingpublic java.lang.Object getSampleValue(ClassLoaderResolver clr)
JavaTypeMapping
getSampleValue in class JavaTypeMappingclr - ClassLoader resolver
protected java.lang.String getReferenceStringForObject(ObjectManager om,
java.lang.Object value)
om - ObjectManagervalue - The object
protected java.lang.Object getObjectForReferenceString(ObjectManager om,
java.lang.String refString)
om - ObjectManagerrefString - The reference string
public void insertPostProcessing(StateManager sm)
MappingCallbacks
insertPostProcessing in interface MappingCallbackssm - StateManagerpublic void postFetch(StateManager sm)
postFetch in interface MappingCallbackssm - StateManager for the owner.public void postInsert(StateManager sm)
postInsert in interface MappingCallbackssm - StateManager for the ownerpublic void postUpdate(StateManager sm)
postUpdate in interface MappingCallbackssm - StateManager for the ownerpublic void preDelete(StateManager sm)
preDelete in interface MappingCallbackssm - StateManager for the owner
public ScalarExpression newLiteral(QueryExpression qs,
java.lang.Object value)
JavaTypeMapping
newLiteral in class JavaTypeMappingqs - The Query statementvalue - The object
public ScalarExpression newScalarExpression(QueryExpression qs,
LogicSetExpression te)
JavaTypeMapping
newScalarExpression in class JavaTypeMappingqs - The Query statementte - the alias for the table
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||