public abstract class AbstractColumnMapping extends Object implements ColumnMapping
Modifier and Type | Field and Description |
---|---|
protected Column |
column
The Column being persisted to.
|
protected JavaTypeMapping |
mapping
Mapping of the Java type.
|
protected RDBMSStoreManager |
storeMgr
Store Manager to use for mapping.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractColumnMapping(RDBMSStoreManager storeMgr,
JavaTypeMapping mapping)
Create a new Mapping with the given DatabaseAdapter for the given type.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
protected String |
failureMessage(String method)
Utility to output any error message.
|
protected String |
failureMessage(String method,
int position,
Exception e)
Utility to output any error message.
|
protected String |
failureMessage(String method,
Object value,
Exception e)
Utility to output any error message.
|
boolean |
getBoolean(ResultSet resultSet,
int exprIndex)
Obtains a value from
resultSet
at position specified by exprIndex . |
byte |
getByte(ResultSet resultSet,
int exprIndex)
Obtains a value from
resultSet
at position specified by exprIndex . |
char |
getChar(ResultSet resultSet,
int exprIndex)
Obtains a value from
resultSet
at position specified by exprIndex . |
Column |
getColumn()
Accessor for the column
|
protected DatastoreAdapter |
getDatastoreAdapter()
Convenience to access the datastore adapter.
|
double |
getDouble(ResultSet resultSet,
int exprIndex)
Obtains a value from
resultSet
at position specified by exprIndex . |
float |
getFloat(ResultSet resultSet,
int exprIndex)
Obtains a value from
resultSet
at position specified by exprIndex . |
String |
getInsertionInputParameter()
Accessor for the string to put in any retrieval datastore statement for this field.
|
int |
getInt(ResultSet resultSet,
int exprIndex)
Obtains a value from
resultSet
at position specified by exprIndex . |
JavaTypeMapping |
getJavaTypeMapping()
Accessor for the java type mapping
|
abstract int |
getJDBCType()
Method to return the java.sql.Types type that this relates to.
|
long |
getLong(ResultSet resultSet,
int exprIndex)
Obtains a value from
resultSet
at position specified by exprIndex . |
Object |
getObject(ResultSet resultSet,
int exprIndex)
Obtains a value from
resultSet
at position specified by exprIndex . |
short |
getShort(ResultSet resultSet,
int exprIndex)
Obtains a value from
resultSet
at position specified by exprIndex . |
String |
getString(ResultSet resultSet,
int exprIndex)
Obtains a value from
resultSet
at position specified by exprIndex . |
SQLTypeInfo |
getTypeInfo()
Accessor for the (SQL) type info for this datastore type.
|
String |
getUpdateInputParameter()
Accessor for the string to put in any update datastore statements for this field.
|
int |
hashCode() |
boolean |
includeInFetchStatement()
Whether this mapping is included in the fetch statement.
|
protected void |
initTypeInfo()
Sets the TypeInfo for the columns of the Mapping.
|
boolean |
insertValuesOnInsert()
Accessor for whether this mapping requires values inserting on an INSERT.
|
boolean |
isBitBased()
Accessor for whether the mapping is bit-based.
|
boolean |
isBooleanBased()
Accessor for whether the mapping is boolean-based.
|
boolean |
isDecimalBased()
Accessor for whether the mapping is decimal-based.
|
boolean |
isIntegerBased()
Accessor for whether the mapping is integer-based.
|
boolean |
isNullable()
Accessor for whether the mapping is nullable.
|
boolean |
isStringBased()
Accessor for whether the mapping is string-based.
|
void |
setBoolean(PreparedStatement ps,
int exprIndex,
boolean value)
Sets a
value into ps
at position specified by paramIndex . |
void |
setByte(PreparedStatement ps,
int exprIndex,
byte value)
Sets a
value into ps
at position specified by paramIndex . |
void |
setChar(PreparedStatement ps,
int exprIndex,
char value)
Sets a
value into ps
at position specified by paramIndex . |
void |
setDouble(PreparedStatement ps,
int exprIndex,
double value)
Sets a
value into ps
at position specified by paramIndex . |
void |
setFloat(PreparedStatement ps,
int exprIndex,
float value)
Sets a
value into ps
at position specified by paramIndex . |
void |
setInt(PreparedStatement ps,
int exprIndex,
int value)
Sets a
value into ps
at position specified by paramIndex . |
void |
setLong(PreparedStatement ps,
int exprIndex,
long value)
Sets a
value into ps
at position specified by paramIndex . |
void |
setObject(PreparedStatement ps,
int exprIndex,
Object value)
Sets a
value into ps
at position specified by paramIndex . |
void |
setShort(PreparedStatement ps,
int exprIndex,
short value)
Sets a
value into ps
at position specified by paramIndex . |
void |
setString(PreparedStatement ps,
int exprIndex,
String value)
Sets a
value into ps
at position specified by paramIndex . |
protected boolean |
useDefaultWhenNull() |
protected final JavaTypeMapping mapping
protected final RDBMSStoreManager storeMgr
protected Column column
protected AbstractColumnMapping(RDBMSStoreManager storeMgr, JavaTypeMapping mapping)
storeMgr
- The Store Manager that this Mapping should use.mapping
- Mapping for the underlying java type. This can be null on an "unmapped column".public JavaTypeMapping getJavaTypeMapping()
getJavaTypeMapping
in interface ColumnMapping
protected DatastoreAdapter getDatastoreAdapter()
protected void initTypeInfo()
public abstract int getJDBCType()
public SQLTypeInfo getTypeInfo()
public boolean isNullable()
isNullable
in interface ColumnMapping
public boolean includeInFetchStatement()
public boolean insertValuesOnInsert()
insertValuesOnInsert
in interface ColumnMapping
public String getInsertionInputParameter()
getInsertionInputParameter
in interface ColumnMapping
public String getUpdateInputParameter()
getUpdateInputParameter
in interface ColumnMapping
public Column getColumn()
getColumn
in interface ColumnMapping
protected boolean useDefaultWhenNull()
protected String failureMessage(String method, int position, Exception e)
method
- The method that failed.position
- The position of the columne
- The exceptionprotected String failureMessage(String method, Object value, Exception e)
method
- The method that failed.value
- Value at the positione
- The exceptionpublic void setBoolean(PreparedStatement ps, int exprIndex, boolean value)
ColumnMapping
value
into ps
at position specified by paramIndex
.setBoolean
in interface ColumnMapping
ps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic boolean getBoolean(ResultSet resultSet, int exprIndex)
ColumnMapping
resultSet
at position specified by exprIndex
.getBoolean
in interface ColumnMapping
resultSet
- ResultSetexprIndex
- the position of the value in the resultpublic void setChar(PreparedStatement ps, int exprIndex, char value)
ColumnMapping
value
into ps
at position specified by paramIndex
.setChar
in interface ColumnMapping
ps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic char getChar(ResultSet resultSet, int exprIndex)
ColumnMapping
resultSet
at position specified by exprIndex
.getChar
in interface ColumnMapping
resultSet
- ResultSetexprIndex
- the position of the value in the resultpublic void setByte(PreparedStatement ps, int exprIndex, byte value)
ColumnMapping
value
into ps
at position specified by paramIndex
.setByte
in interface ColumnMapping
ps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic byte getByte(ResultSet resultSet, int exprIndex)
ColumnMapping
resultSet
at position specified by exprIndex
.getByte
in interface ColumnMapping
resultSet
- ResultSetexprIndex
- the position of the value in the resultpublic void setShort(PreparedStatement ps, int exprIndex, short value)
ColumnMapping
value
into ps
at position specified by paramIndex
.setShort
in interface ColumnMapping
ps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic short getShort(ResultSet resultSet, int exprIndex)
ColumnMapping
resultSet
at position specified by exprIndex
.getShort
in interface ColumnMapping
resultSet
- ResultSetexprIndex
- the position of the value in the resultpublic void setInt(PreparedStatement ps, int exprIndex, int value)
ColumnMapping
value
into ps
at position specified by paramIndex
.setInt
in interface ColumnMapping
ps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic int getInt(ResultSet resultSet, int exprIndex)
ColumnMapping
resultSet
at position specified by exprIndex
.getInt
in interface ColumnMapping
resultSet
- ResultSetexprIndex
- the position of the value in the resultpublic void setLong(PreparedStatement ps, int exprIndex, long value)
ColumnMapping
value
into ps
at position specified by paramIndex
.setLong
in interface ColumnMapping
ps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic long getLong(ResultSet resultSet, int exprIndex)
ColumnMapping
resultSet
at position specified by exprIndex
.getLong
in interface ColumnMapping
resultSet
- ResultSetexprIndex
- the position of the value in the resultpublic void setFloat(PreparedStatement ps, int exprIndex, float value)
ColumnMapping
value
into ps
at position specified by paramIndex
.setFloat
in interface ColumnMapping
ps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic float getFloat(ResultSet resultSet, int exprIndex)
ColumnMapping
resultSet
at position specified by exprIndex
.getFloat
in interface ColumnMapping
resultSet
- ResultSetexprIndex
- the position of the value in the resultpublic void setDouble(PreparedStatement ps, int exprIndex, double value)
ColumnMapping
value
into ps
at position specified by paramIndex
.setDouble
in interface ColumnMapping
ps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic double getDouble(ResultSet resultSet, int exprIndex)
ColumnMapping
resultSet
at position specified by exprIndex
.getDouble
in interface ColumnMapping
resultSet
- ResultSetexprIndex
- the position of the value in the resultpublic void setString(PreparedStatement ps, int exprIndex, String value)
ColumnMapping
value
into ps
at position specified by paramIndex
.setString
in interface ColumnMapping
ps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic String getString(ResultSet resultSet, int exprIndex)
ColumnMapping
resultSet
at position specified by exprIndex
.getString
in interface ColumnMapping
resultSet
- ResultSetexprIndex
- the position of the value in the resultpublic void setObject(PreparedStatement ps, int exprIndex, Object value)
ColumnMapping
value
into ps
at position specified by paramIndex
.setObject
in interface ColumnMapping
ps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the valuepublic Object getObject(ResultSet resultSet, int exprIndex)
ColumnMapping
resultSet
at position specified by exprIndex
.getObject
in interface ColumnMapping
resultSet
- ResultSetexprIndex
- the position of the value in the resultpublic boolean isDecimalBased()
isDecimalBased
in interface ColumnMapping
public boolean isIntegerBased()
isIntegerBased
in interface ColumnMapping
public boolean isStringBased()
isStringBased
in interface ColumnMapping
public boolean isBitBased()
isBitBased
in interface ColumnMapping
public boolean isBooleanBased()
isBooleanBased
in interface ColumnMapping
Copyright © 2020. All rights reserved.