public abstract class JavaTypeMapping extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
absFieldNumber
Absolute field number for this mapping.
|
protected ColumnMapping[] |
columnMappings
The Column mappings for this Java type.
|
protected org.datanucleus.metadata.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 org.datanucleus.metadata.FieldRole |
roleForMember
Role of the mapping for the field.
|
protected RDBMSStoreManager |
storeMgr
StoreManager for the datastore being used.
|
protected Table |
table
The Table storing this mapping.
|
protected String |
type
Actual type being mapped
|
Modifier | Constructor and Description |
---|---|
protected |
JavaTypeMapping()
Create a new empty JavaTypeMapping.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumnMapping(ColumnMapping cm)
Method to add a column mapping
|
boolean |
equals(Object obj)
Equality operator.
|
protected String |
failureMessage(String method)
Utility to output any error message.
|
protected int |
getAbsoluteFieldNumber() |
boolean |
getBoolean(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex)
Obtains a value from
datastoreResults at position specified by exprIndex . |
byte |
getByte(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex)
Obtains a value from
datastoreResults at position specified by exprIndex . |
char |
getChar(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex)
Obtains a value from
datastoreResults at position specified by exprIndex . |
ColumnMapping |
getColumnMapping(int index)
Accessor for a column mapping
|
ColumnMapping[] |
getColumnMappings()
Accessor for the column mappings for this java type
|
protected static org.datanucleus.metadata.ColumnMetaData[] |
getColumnMetaDataForMember(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.metadata.FieldRole role)
Convenience method to return the ColumnMetaData appropriate for this mapping.
|
double |
getDouble(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex)
Obtains a value from
datastoreResults at position specified by exprIndex . |
float |
getFloat(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex)
Obtains a value from
datastoreResults at position specified by exprIndex . |
int |
getInt(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex)
Obtains a value from
datastoreResults at position specified by exprIndex . |
abstract Class |
getJavaType()
Accessor for the java type being mapped.
|
String |
getJavaTypeForColumnMapping(int index)
Accessor for the name of the java-type actually used when mapping the particular column.
|
long |
getLong(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex)
Obtains a value from
datastoreResults at position specified by exprIndex . |
org.datanucleus.metadata.AbstractMemberMetaData |
getMemberMetaData()
Accessor for the MetaData of the field/property being mapped.
|
int |
getNumberOfColumnMappings()
Accessor for the number of column mappings.
|
Object |
getObject(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex)
Obtains a value from
datastoreResults at position specified by exprIndex . |
Object |
getObject(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex,
org.datanucleus.state.ObjectProvider ownerOP,
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.
|
org.datanucleus.metadata.FieldRole |
getRoleForMember()
Accessor for the role of this mapping for the field/property.
|
short |
getShort(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex)
Obtains a value from
datastoreResults at position specified by exprIndex . |
RDBMSStoreManager |
getStoreManager() |
String |
getString(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] exprIndex)
Obtains a value from
datastoreResults at position specified by exprIndex . |
Table |
getTable()
Accessor for the table.
|
String |
getType()
Accessor for the class name of the object that is being mapped here.
|
Object |
getValueForColumnMapping(org.datanucleus.NucleusContext nucleusCtx,
int index,
Object value)
Method to return the value to be stored in the specified column 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(org.datanucleus.metadata.AbstractMemberMetaData mmd,
Table table,
org.datanucleus.ClassLoaderResolver clr)
Initialize this JavaTypeMapping for the supplied table and field/property metadata.
|
void |
initialize(RDBMSStoreManager storeMgr,
String type)
Initialise 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.
|
boolean |
representableAsStringLiteralInStatement()
The vast majority of types can be added to a (SQL) statement in their String form
and the statement would operate ok.
|
void |
setAbsFieldNumber(int num) |
void |
setBoolean(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
boolean value)
Sets a
value into datastoreStatement at position specified by exprIndex . |
void |
setByte(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
byte value)
Sets a
value into datastoreStatement at position specified by exprIndex . |
void |
setChar(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
char value)
Sets a
value into datastoreStatement at position specified by exprIndex . |
void |
setDouble(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
double value)
Sets a
value into datastoreStatement at position specified by exprIndex . |
void |
setFloat(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
float value)
Sets a
value into datastoreStatement at position specified by exprIndex . |
void |
setInt(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
int value)
Sets a
value into datastoreStatement at position specified by exprIndex . |
void |
setLong(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
long value)
Sets a
value into datastoreStatement at position specified by exprIndex . |
void |
setMemberMetaData(org.datanucleus.metadata.AbstractMemberMetaData mmd)
Method to set the metadata of the member for which this mapping applies.
|
void |
setObject(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
Object value)
Sets a
value into datastoreStatement at position specified by exprIndex . |
void |
setObject(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
Object value,
org.datanucleus.state.ObjectProvider ownerOP,
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(org.datanucleus.metadata.FieldRole role)
Method to set the role for the field/property.
|
void |
setShort(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
short value)
Sets a
value into datastoreStatement at position specified by exprIndex . |
void |
setString(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] exprIndex,
String value)
Sets a
value into datastoreStatement at position specified by exprIndex . |
void |
setTable(Table table) |
protected org.datanucleus.metadata.AbstractMemberMetaData mmd
protected org.datanucleus.metadata.FieldRole roleForMember
protected ColumnMapping[] columnMappings
protected Table table
protected RDBMSStoreManager storeMgr
protected String type
protected JavaTypeMapping referenceMapping
protected int absFieldNumber
protected JavaTypeMapping()
public void initialize(RDBMSStoreManager storeMgr, String type)
storeMgr
- The Datastore Adapter that this Mapping should use.type
- The Class that this mapping maps to the database.public void initialize(org.datanucleus.metadata.AbstractMemberMetaData mmd, Table table, org.datanucleus.ClassLoaderResolver clr)
mmd
- MetaData for the field/property to be mapped (if any)table
- The table storing this mapping (if any)clr
- the ClassLoaderResolverpublic int hashCode()
public boolean equals(Object obj)
public void setMemberMetaData(org.datanucleus.metadata.AbstractMemberMetaData mmd)
mmd
- Field/Property MetaDatapublic org.datanucleus.metadata.AbstractMemberMetaData getMemberMetaData()
public RDBMSStoreManager getStoreManager()
public void setTable(Table table)
public Table getTable()
public org.datanucleus.metadata.FieldRole getRoleForMember()
public void setRoleForMember(org.datanucleus.metadata.FieldRole role)
role
- Role for field/property.protected int getAbsoluteFieldNumber()
public void setAbsFieldNumber(int num)
public boolean isSerialised()
public boolean isNullable()
public boolean hasSimpleDatastoreRepresentation()
public boolean representableAsStringLiteralInStatement()
public ColumnMapping[] getColumnMappings()
public ColumnMapping getColumnMapping(int index)
index
- The id of the columnpublic void addColumnMapping(ColumnMapping cm)
cm
- The column mappingpublic int getNumberOfColumnMappings()
public Object getValueForColumnMapping(org.datanucleus.NucleusContext nucleusCtx, int index, Object value)
nucleusCtx
- Contextindex
- The datastore indexvalue
- The overall value for this java typepublic JavaTypeMapping getReferenceMapping()
public void setReferenceMapping(JavaTypeMapping referenceMapping)
referenceMapping
- The mapping at the other endpublic abstract Class getJavaType()
public String getJavaTypeForColumnMapping(int index)
index
- requested column index.public String getType()
public boolean includeInFetchStatement()
public boolean includeInUpdateStatement()
public boolean includeInInsertStatement()
protected String failureMessage(String method)
method
- The method that failed.public void setBoolean(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, boolean value)
value
into datastoreStatement
at position specified by exprIndex
.ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic boolean getBoolean(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- ResultSetexprIndex
- the position of the value in the resultpublic void setChar(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, char value)
value
into datastoreStatement
at position specified by exprIndex
.ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic char getChar(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- ResultSetexprIndex
- the position of the value in the resultpublic void setByte(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, byte value)
value
into datastoreStatement
at position specified by exprIndex
.ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic byte getByte(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- ResultSetexprIndex
- the position of the value in the resultpublic void setShort(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, short value)
value
into datastoreStatement
at position specified by exprIndex
.ec
- execution contextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic short getShort(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- ResultSetexprIndex
- the position of the value in the resultpublic void setInt(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, int value)
value
into datastoreStatement
at position specified by exprIndex
.ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic int getInt(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- ResultSetexprIndex
- the position of the value in the resultpublic void setLong(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, long value)
value
into datastoreStatement
at position specified by exprIndex
.ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic long getLong(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- ResultSetexprIndex
- the position of the value in the resultpublic void setFloat(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, float value)
value
into datastoreStatement
at position specified by exprIndex
.ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic float getFloat(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- ResultSetexprIndex
- the position of the value in the resultpublic void setDouble(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, double value)
value
into datastoreStatement
at position specified by exprIndex
.ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic double getDouble(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- ResultSetexprIndex
- the position of the value in the resultpublic void setString(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, String value)
value
into datastoreStatement
at position specified by exprIndex
.ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic String getString(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- ResultSetexprIndex
- the position of the value in the resultpublic void setObject(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, Object value, org.datanucleus.state.ObjectProvider ownerOP, int ownerFieldNumber)
value
into datastoreStatement
at position specified by exprIndex
.ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valueownerOP
- the owner ObjectProviderownerFieldNumber
- the owner absolute field numberpublic void setObject(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, Object value)
value
into datastoreStatement
at position specified by exprIndex
.ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic Object getObject(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex, org.datanucleus.state.ObjectProvider ownerOP, int ownerFieldNumber)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- an object returned from the datastore with valuesexprIndex
- the position of the value in the resultownerOP
- the owner ObjectProviderownerFieldNumber
- the owner absolute field numberpublic Object getObject(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] exprIndex)
datastoreResults
at position specified by exprIndex
.ec
- ExecutionContextrs
- ResultSetexprIndex
- the position of the value in the resultprotected static org.datanucleus.metadata.ColumnMetaData[] getColumnMetaDataForMember(org.datanucleus.metadata.AbstractMemberMetaData mmd, org.datanucleus.metadata.FieldRole role)
mmd
- Metadata for the memberrole
- The role this mapping plays for the specified memberCopyright © 2020. All rights reserved.