Class CharColumnMapping
- java.lang.Object
-
- org.datanucleus.store.rdbms.mapping.column.AbstractColumnMapping
-
- org.datanucleus.store.rdbms.mapping.column.CharColumnMapping
-
- All Implemented Interfaces:
ColumnMapping
- Direct Known Subclasses:
DB2DatalinkColumnMapping
,NCharColumnMapping
,VarCharColumnMapping
public class CharColumnMapping extends AbstractColumnMapping
Mapping of a CHAR column.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
CharColumnMapping.FormatterInfo
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.ThreadLocal<CharColumnMapping.FormatterInfo>
formatterThreadInfo
-
Fields inherited from class org.datanucleus.store.rdbms.mapping.column.AbstractColumnMapping
column, mapping, storeMgr
-
-
Constructor Summary
Constructors Constructor Description CharColumnMapping(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getBoolean(java.sql.ResultSet rs, int param)
Method to extract a boolean from the ResultSet at the specified positionchar
getChar(java.sql.ResultSet rs, int param)
Method to extract a character from the ResultSet at the specified positionjava.text.SimpleDateFormat
getJavaUtilDateFormat()
Get a Format object to handle java.util.Date.int
getJDBCType()
Method to return the java.sql.Types type that this relates to.java.lang.Object
getObject(java.sql.ResultSet rs, int param)
Method to extract an object from the ResultSet at the specified positionjava.lang.String
getString(java.sql.ResultSet rs, int param)
Method to extract a String from the ResultSet at the specified positionprotected void
initialize()
Method to initialise the column mapping.boolean
isStringBased()
Accessor for whether the mapping is string-based.void
setBoolean(java.sql.PreparedStatement ps, int param, boolean value)
Method to set a boolean at the specified position in the JDBC PreparedStatement.void
setChar(java.sql.PreparedStatement ps, int param, char value)
Method to set a character at the specified position in the JDBC PreparedStatement.void
setObject(java.sql.PreparedStatement ps, int param, java.lang.Object value)
Method to set an object at the specified position in the JDBC PreparedStatement.void
setString(java.sql.PreparedStatement ps, int param, java.lang.String value)
Method to set a String at the specified position in the JDBC PreparedStatement.-
Methods inherited from class org.datanucleus.store.rdbms.mapping.column.AbstractColumnMapping
equals, failureMessage, failureMessage, failureMessage, getByte, getColumn, getDatastoreAdapter, getDouble, getFloat, getInsertionInputParameter, getInt, getJavaTypeMapping, getLong, getShort, getTypeInfo, getUpdateInputParameter, hashCode, includeInFetchStatement, initTypeInfo, insertValuesOnInsert, isBitBased, isBooleanBased, isDecimalBased, isIntegerBased, isNullable, setByte, setDouble, setFloat, setInt, setLong, setShort, useDefaultWhenNull
-
-
-
-
Field Detail
-
formatterThreadInfo
private static final java.lang.ThreadLocal<CharColumnMapping.FormatterInfo> formatterThreadInfo
-
-
Constructor Detail
-
CharColumnMapping
public CharColumnMapping(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col)
Constructor.- Parameters:
mapping
- Java type mappingstoreMgr
- Store Managercol
- column to be mapped
-
-
Method Detail
-
initialize
protected void initialize()
Method to initialise the column mapping. Provides default length specifications for the CHAR column to fit the data being stored.
-
isStringBased
public boolean isStringBased()
Accessor for whether the mapping is string-based.- Specified by:
isStringBased
in interfaceColumnMapping
- Overrides:
isStringBased
in classAbstractColumnMapping
- Returns:
- Whether the mapping is string based
-
getJDBCType
public int getJDBCType()
Description copied from class:AbstractColumnMapping
Method to return the java.sql.Types type that this relates to.- Specified by:
getJDBCType
in classAbstractColumnMapping
- Returns:
- The JDBC "type"
-
setChar
public void setChar(java.sql.PreparedStatement ps, int param, char value)
Method to set a character at the specified position in the JDBC PreparedStatement.- Specified by:
setChar
in interfaceColumnMapping
- Overrides:
setChar
in classAbstractColumnMapping
- Parameters:
ps
- The PreparedStatementparam
- Parameter positionvalue
- The value to set
-
getChar
public char getChar(java.sql.ResultSet rs, int param)
Method to extract a character from the ResultSet at the specified position- Specified by:
getChar
in interfaceColumnMapping
- Overrides:
getChar
in classAbstractColumnMapping
- Parameters:
rs
- The Result Setparam
- The parameter position- Returns:
- the character
-
setString
public void setString(java.sql.PreparedStatement ps, int param, java.lang.String value)
Method to set a String at the specified position in the JDBC PreparedStatement.- Specified by:
setString
in interfaceColumnMapping
- Overrides:
setString
in classAbstractColumnMapping
- Parameters:
ps
- The PreparedStatementparam
- Parameter positionvalue
- The value to set
-
getString
public java.lang.String getString(java.sql.ResultSet rs, int param)
Method to extract a String from the ResultSet at the specified position- Specified by:
getString
in interfaceColumnMapping
- Overrides:
getString
in classAbstractColumnMapping
- Parameters:
rs
- The Result Setparam
- The parameter position- Returns:
- the String
-
setBoolean
public void setBoolean(java.sql.PreparedStatement ps, int param, boolean value)
Method to set a boolean at the specified position in the JDBC PreparedStatement.- Specified by:
setBoolean
in interfaceColumnMapping
- Overrides:
setBoolean
in classAbstractColumnMapping
- Parameters:
ps
- The PreparedStatementparam
- Parameter positionvalue
- The value to set
-
getBoolean
public boolean getBoolean(java.sql.ResultSet rs, int param)
Method to extract a boolean from the ResultSet at the specified position- Specified by:
getBoolean
in interfaceColumnMapping
- Overrides:
getBoolean
in classAbstractColumnMapping
- Parameters:
rs
- The Result Setparam
- The parameter position- Returns:
- the boolean
-
setObject
public void setObject(java.sql.PreparedStatement ps, int param, java.lang.Object value)
Method to set an object at the specified position in the JDBC PreparedStatement.- Specified by:
setObject
in interfaceColumnMapping
- Overrides:
setObject
in classAbstractColumnMapping
- Parameters:
ps
- The PreparedStatementparam
- Parameter positionvalue
- The value to set
-
getObject
public java.lang.Object getObject(java.sql.ResultSet rs, int param)
Method to extract an object from the ResultSet at the specified position- Specified by:
getObject
in interfaceColumnMapping
- Overrides:
getObject
in classAbstractColumnMapping
- Parameters:
rs
- The Result Setparam
- The parameter position- Returns:
- the object
-
getJavaUtilDateFormat
public java.text.SimpleDateFormat getJavaUtilDateFormat()
Get a Format object to handle java.util.Date. If a TimeZone is present, it will be used to format dates to that zone.- Returns:
- Date formatter to use
-
-