|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.mapped.mapping.JavaTypeMapping
public abstract class JavaTypeMapping
Representation of the mapping of a Java type. The java type maps to one or more datastore mappings. This means that a field/property in a java class can be mapped to many columns in a table (in an RDBMS). A JavaTypeMapping can exist in 2 forms
| Field Summary | |
|---|---|
protected DatastoreContainerObject |
datastoreContainer
The Datastore Container storing this mapping. |
protected DatastoreMapping[] |
datastoreMappings
The Datastore mappings for this Java type. |
protected static Localiser |
LOCALISER
Localiser for messages |
protected AbstractMemberMetaData |
mmd
MetaData for the field/property that we are mapping. |
protected JavaTypeMapping |
referenceMapping
Mapping of the reference on the end of a bidirectional association. |
protected int |
roleForMember
Role of the mapping for the field. |
protected MappedStoreManager |
storeMgr
StoreManager for the datastore being used. |
protected java.lang.String |
type
Actual type being mapped |
| Constructor Summary | |
|---|---|
protected |
JavaTypeMapping()
Create a new empty JavaTypeMapping. |
| Method Summary | |
|---|---|
void |
addDatastoreMapping(DatastoreMapping datastoreMapping)
Method to add a datastore mapping |
boolean |
equals(java.lang.Object obj)
Equality operator. |
protected java.lang.String |
failureMessage(java.lang.String method)
Utility to output any error message. |
boolean |
getBoolean(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
Obtains a value from datastoreResults
at position specified by exprIndex. |
byte |
getByte(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
Obtains a value from datastoreResults
at position specified by exprIndex. |
char |
getChar(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
Obtains a value from datastoreResults
at position specified by exprIndex. |
protected static ColumnMetaData[] |
getColumnMetaDataForMember(AbstractMemberMetaData mmd,
int role)
Convenience method to return the ColumnMetaData appropriate for this mapping. |
DatastoreContainerObject |
getDatastoreContainer()
Accessor for the datastore class (e.g in an RDBMS context, the Table). |
DatastoreMapping |
getDatastoreMapping(int index)
Accessor for a datastore mapping |
DatastoreMapping[] |
getDatastoreMappings()
Accessor for the datastore mappings for this java type |
double |
getDouble(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
Obtains a value from datastoreResults
at position specified by exprIndex. |
float |
getFloat(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
Obtains a value from datastoreResults
at position specified by exprIndex. |
int |
getInt(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
Obtains a value from datastoreResults
at position specified by exprIndex. |
abstract java.lang.Class |
getJavaType()
Accessor for the java type being mapped. |
java.lang.String |
getJavaTypeForDatastoreMapping(int index)
Accessor for the name of the java-type actually used when mapping the particular datastore field. |
long |
getLong(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
Obtains a value from datastoreResults
at position specified by exprIndex. |
AbstractMemberMetaData |
getMemberMetaData()
Accessor for the MetaData of the field/property to be mapped. |
int |
getNumberOfDatastoreMappings()
Acessor for the number of datastore mappings. |
java.lang.Object |
getObject(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
Obtains a value from datastoreResults
at position specified by exprIndex. |
java.lang.Object |
getObject(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex,
StateManager ownerSM,
int ownerFieldNumber)
Obtains a value from datastoreResults
at position specified by exprIndex. |
JavaTypeMapping |
getReferenceMapping()
Accessor for the mapping at the other end of a relation when this field is part of a 1-1, 1-N, M-N (bidirectional) relation. |
int |
getRoleForMember()
Accessor for the role of this mapping for the field/property. |
java.lang.Object |
getSampleValue(ClassLoaderResolver clr)
Return a sample value of the mapping type to be used for internal evaluation of type/conversion. |
short |
getShort(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
Obtains a value from datastoreResults
at position specified by exprIndex. |
java.lang.String |
getString(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
Obtains a value from datastoreResults
at position specified by exprIndex. |
java.lang.String |
getType()
Accessor for the class name of the object that is being mapped here. |
java.lang.Object |
getValueForDatastoreMapping(OMFContext omfCtx,
int index,
java.lang.Object value)
Method to return the value to be stored in the specified datastore index given the overall value for this java type. |
int |
hashCode()
Hash code function. |
boolean |
hasSimpleDatastoreRepresentation()
Whether the mapping has a simple (single column) datastore representation. |
boolean |
includeInFetchStatement()
Accessor for whether this mapping is to be included in any fetch statement. |
boolean |
includeInInsertStatement()
Accessor for whether this mapping is to be included in the insert statement. |
boolean |
includeInUpdateStatement()
Accessor for whether this mapping is to be included in the update statement. |
void |
initialize(AbstractMemberMetaData mmd,
DatastoreContainerObject container,
ClassLoaderResolver clr)
Initialize this JavaTypeMapping for the supplied table and field/property metadata. |
void |
initialize(MappedStoreManager storeMgr,
java.lang.String type)
Initialize this JavaTypeMapping with the given StoreManager for the given type. |
boolean |
isNullable()
Accessor for whether this mapping is nullable |
boolean |
isSerialised()
Convenience method to return if the (part of the) field being represented by this mapping is serialised. |
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 |
setBoolean(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
boolean value)
Sets a value into datastoreStatement
at position specified by exprIndex. |
void |
setByte(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
byte value)
Sets a value into datastoreStatement
at position specified by exprIndex. |
void |
setChar(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
char value)
Sets a value into datastoreStatement
at position specified by exprIndex. |
void |
setDatastoreContainer(DatastoreContainerObject table)
|
void |
setDefault(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex)
Convenience setter to provide a default value for this field. |
void |
setDouble(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
double value)
Sets a value into datastoreStatement
at position specified by exprIndex. |
void |
setFloat(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
float value)
Sets a value into datastoreStatement
at position specified by exprIndex. |
void |
setInt(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
int value)
Sets a value into datastoreStatement
at position specified by exprIndex. |
void |
setLong(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
long value)
Sets a value into datastoreStatement
at position specified by exprIndex. |
void |
setMemberMetaData(AbstractMemberMetaData mmd)
Method to set the metadata of the member for which this mapping applies. |
void |
setObject(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
java.lang.Object value)
Sets a value into datastoreStatement
at position specified by exprIndex. |
void |
setObject(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
java.lang.Object value,
StateManager ownerSM,
int ownerFieldNumber)
Sets a value into datastoreStatement
at position specified by exprIndex. |
void |
setReferenceMapping(JavaTypeMapping referenceMapping)
Method to set the mapping at the other end of the relation. |
void |
setRoleForMember(int role)
Method to set the role for the field/property. |
void |
setShort(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
short value)
Sets a value into datastoreStatement
at position specified by exprIndex. |
void |
setString(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
java.lang.String value)
Sets a value into datastoreStatement
at position specified by exprIndex. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Localiser LOCALISER
protected AbstractMemberMetaData mmd
protected int roleForMember
protected DatastoreMapping[] datastoreMappings
protected DatastoreContainerObject datastoreContainer
protected MappedStoreManager storeMgr
protected java.lang.String type
protected JavaTypeMapping referenceMapping
| Constructor Detail |
|---|
protected JavaTypeMapping()
| Method Detail |
|---|
public void initialize(MappedStoreManager storeMgr,
java.lang.String type)
storeMgr - The Datastore Adapter that this Mapping should use.type - The Class that this mapping maps to the database.MappingFactory.createMapping(Class, MappedStoreManager, String)
public void initialize(AbstractMemberMetaData mmd,
DatastoreContainerObject container,
ClassLoaderResolver clr)
mmd - MetaData for the field/property to be mapped (if any)container - The datastore container storing this mapping (if any)clr - the ClassLoaderResolverpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - Object to compare against
public void setMemberMetaData(AbstractMemberMetaData mmd)
mmd - Field/Property MetaDatapublic void setDatastoreContainer(DatastoreContainerObject table)
public void setRoleForMember(int role)
role - Role for field/property.public AbstractMemberMetaData getMemberMetaData()
public int getRoleForMember()
public boolean isSerialised()
public boolean isNullable()
public boolean hasSimpleDatastoreRepresentation()
public DatastoreMapping[] getDatastoreMappings()
public DatastoreContainerObject getDatastoreContainer()
public DatastoreMapping getDatastoreMapping(int index)
index - The id of the mapping
public java.lang.Object getValueForDatastoreMapping(OMFContext omfCtx,
int index,
java.lang.Object value)
omfCtx - OMF Contextindex - The datastore indexvalue - The overall value for this java type
public JavaTypeMapping getReferenceMapping()
public void setReferenceMapping(JavaTypeMapping referenceMapping)
referenceMapping - The mapping at the other endpublic void addDatastoreMapping(DatastoreMapping datastoreMapping)
datastoreMapping - The datastore mappingpublic int getNumberOfDatastoreMappings()
public abstract java.lang.Class getJavaType()
public java.lang.String getJavaTypeForDatastoreMapping(int index)
index - requested datastore field index.
public java.lang.String getType()
public boolean includeInFetchStatement()
public boolean includeInUpdateStatement()
public boolean includeInInsertStatement()
protected java.lang.String failureMessage(java.lang.String method)
method - The method that failed.
public void setDefault(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex)
om - The ObjectManagerdatastoreStatement - Prepared StatementexprIndex - The indices in the statement
public void setBoolean(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
boolean value)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the value
public boolean getBoolean(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the result
public void setChar(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
char value)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the value
public char getChar(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the result
public void setByte(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
byte value)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the value
public byte getByte(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the result
public void setShort(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
short value)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the value
public short getShort(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the result
public void setInt(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
int value)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the value
public int getInt(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the result
public void setLong(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
long value)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the value
public long getLong(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the result
public void setFloat(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
float value)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the value
public float getFloat(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the result
public void setDouble(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
double value)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the value
public double getDouble(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the result
public void setString(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
java.lang.String value)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the value
public java.lang.String getString(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the result
public void setObject(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
java.lang.Object value,
StateManager ownerSM,
int ownerFieldNumber)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the valueownerSM - the owner StateManagerownerFieldNumber - the owner absolute field number
public void setObject(ObjectManager om,
java.lang.Object datastoreStatement,
int[] exprIndex,
java.lang.Object value)
value into datastoreStatement
at position specified by exprIndex.
om - the ObjectManagerdatastoreStatement - a datastore object that executes statements in the databaseexprIndex - the position of the value in the statementvalue - the value
public java.lang.Object getObject(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex,
StateManager ownerSM,
int ownerFieldNumber)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the resultownerSM - the owner StateManagerownerFieldNumber - the owner absolute field number
public java.lang.Object getObject(ObjectManager om,
java.lang.Object datastoreResults,
int[] exprIndex)
datastoreResults
at position specified by exprIndex.
om - the ObjectManagerdatastoreResults - an object returned from the datastore with valuesexprIndex - the position of the value in the result
protected static ColumnMetaData[] getColumnMetaDataForMember(AbstractMemberMetaData mmd,
int role)
public java.lang.Object getSampleValue(ClassLoaderResolver clr)
clr - ClassLoader resolver
public ScalarExpression newLiteral(QueryExpression qs,
java.lang.Object value)
qs - The Query statementvalue - The object
public ScalarExpression newScalarExpression(QueryExpression qs,
LogicSetExpression te)
qs - The Query statementte - the alias for the table
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||