org.jpox.store.rdbms.mapping
Class CharRDBMSMapping

java.lang.Object
  extended byorg.jpox.store.rdbms.mapping.RDBMSMapping
      extended byorg.jpox.store.rdbms.mapping.ColumnMapping
          extended byorg.jpox.store.rdbms.mapping.CharRDBMSMapping
All Implemented Interfaces:
DatastoreMapping
Direct Known Subclasses:
DatalinkRDBMSMapping, VarCharRDBMSMapping

public class CharRDBMSMapping
extends ColumnMapping

Mapping of a CHAR RDBMS type.

Version:
$Revision: 1.29 $

Field Summary
protected static int CHAR_LENGTH
          Default length of a CHAR column storing a Character/char.
protected static int DATE_STRING_LENGTH
          Default length of a CHAR column storing Date, based on JDBC date escape format: "YYYY-MM-DD".
protected static int JAVA_UTIL_DATE_STRING_LENGTH
          Default length of a CHAR column storing java.util.Date, based on JDBC date escape format "dow mon dd hh:mm:ss zzz yyyy"
protected static int LOCALE_LENGTH
          Default length of a CHAR column storing a Locale.
protected static int TIME_STRING_LENGTH
          Default length of a CHAR column storing Time, based on JDBC date escape format: "hh:mm:ss".
protected static int TIMESTAMP_STRING_LENGTH
          Default length of a CHAR column storing Timestamp, based on JDBC timestamp escape format "YYYY-MM-DD HH:MM:SS.FFFFFFFFF"
protected static int TIMEZONE_LENGTH
          Default length of a CHAR column storing a Timezone.
 
Fields inherited from class org.jpox.store.rdbms.mapping.ColumnMapping
column
 
Fields inherited from class org.jpox.store.rdbms.mapping.RDBMSMapping
LOCALISER, LOCALISER_STORE, mapping, storeMgr
 
Constructor Summary
  CharRDBMSMapping(JavaTypeMapping mapping, StoreManager storeMgr, DatastoreField field)
          Constructor.
protected CharRDBMSMapping(StoreManager storeMgr, JavaTypeMapping mapping)
          Constructor.
 
Method Summary
 boolean getBoolean(java.lang.Object rs, int param)
          Method to extract a boolean from the ResultSet at the specified position
 char getChar(java.lang.Object rs, int param)
          Method to extract a character from the ResultSet at the specified position
 DatastoreField getDatastoreField()
          Accessor for the datastore field.
 java.util.Locale getLocale(java.lang.Object rs, int param)
          Method to extract a Locale from the ResultSet at the specified position
 java.lang.Object getObject(java.lang.Object rs, int param)
          Method to extract an object from the ResultSet at the specified position
 java.lang.String getString(java.lang.Object rs, int param)
          Method to extract a String from the ResultSet at the specified position
 java.util.TimeZone getTimeZone(java.lang.Object rs, int param)
          Accessor for the TimeZone.
 TypeInfo getTypeInfo()
          Accessor for the JDBC type being stored here.
protected  void initialize()
          Method to initialise the column mapping.
 void setBoolean(java.lang.Object ps, int param, boolean value)
          Method to set a boolean at the specified position in the JDBC PreparedStatement.
 void setChar(java.lang.Object ps, int param, char value)
          Method to set a character at the specified position in the JDBC PreparedStatement.
 void setLocale(java.lang.Object ps, int param, java.util.Locale value)
          Method to set a Locale at the specified position in the JDBC PreparedStatement.
 void setObject(java.lang.Object ps, int param, java.lang.Object value)
          Method to set an object at the specified position in the JDBC PreparedStatement.
 void setString(java.lang.Object ps, int param, java.lang.String value)
          Method to set a String at the specified position in the JDBC PreparedStatement.
 void setTimeZone(java.lang.Object ps, int param, java.util.TimeZone value)
          Mutator for the TimeZone object.
 
Methods inherited from class org.jpox.store.rdbms.mapping.ColumnMapping
equals, getColumn, getInsertionInputParameter, getUpdateInputParameter, hashCode, includeInFetchStatement, initTypeInfo, isNullable
 
Methods inherited from class org.jpox.store.rdbms.mapping.RDBMSMapping
failureMessage, getByte, getDatabaseAdapter, getDouble, getFloat, getInt, getJavaTypeMapping, getLong, getShort, setByte, setDouble, setFloat, setInt, setLong, setShort
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHAR_LENGTH

protected static final int CHAR_LENGTH
Default length of a CHAR column storing a Character/char.

See Also:
Constant Field Values

LOCALE_LENGTH

protected static final int LOCALE_LENGTH
Default length of a CHAR column storing a Locale.

See Also:
Constant Field Values

TIME_STRING_LENGTH

protected static final int TIME_STRING_LENGTH
Default length of a CHAR column storing Time, based on JDBC date escape format: "hh:mm:ss".

See Also:
Constant Field Values

DATE_STRING_LENGTH

protected static final int DATE_STRING_LENGTH
Default length of a CHAR column storing Date, based on JDBC date escape format: "YYYY-MM-DD".

See Also:
Constant Field Values

TIMESTAMP_STRING_LENGTH

protected static final int TIMESTAMP_STRING_LENGTH
Default length of a CHAR column storing Timestamp, based on JDBC timestamp escape format "YYYY-MM-DD HH:MM:SS.FFFFFFFFF"

See Also:
Constant Field Values

JAVA_UTIL_DATE_STRING_LENGTH

protected static final int JAVA_UTIL_DATE_STRING_LENGTH
Default length of a CHAR column storing java.util.Date, based on JDBC date escape format "dow mon dd hh:mm:ss zzz yyyy"

See Also:
Constant Field Values

TIMEZONE_LENGTH

protected static final int TIMEZONE_LENGTH
Default length of a CHAR column storing a Timezone.

See Also:
Constant Field Values
Constructor Detail

CharRDBMSMapping

protected CharRDBMSMapping(StoreManager storeMgr,
                           JavaTypeMapping mapping)
Constructor.

Parameters:
storeMgr - Store Manager
mapping - Java type mapping

CharRDBMSMapping

public CharRDBMSMapping(JavaTypeMapping mapping,
                        StoreManager storeMgr,
                        DatastoreField field)
Constructor.

Parameters:
mapping - Java type mapping
storeMgr - Store Manager
field - Field 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.


getTypeInfo

public TypeInfo getTypeInfo()
Accessor for the JDBC type being stored here.

Specified by:
getTypeInfo in class ColumnMapping
Returns:
JDBC Types.CHAR

getDatastoreField

public DatastoreField getDatastoreField()
Accessor for the datastore field.

Specified by:
getDatastoreField in interface DatastoreMapping
Overrides:
getDatastoreField in class ColumnMapping
Returns:
The datastore field (column)

setTimeZone

public void setTimeZone(java.lang.Object ps,
                        int param,
                        java.util.TimeZone value)
Mutator for the TimeZone object.

Parameters:
ps - The statement
param - The parameter id
value - The object value

getTimeZone

public java.util.TimeZone getTimeZone(java.lang.Object rs,
                                      int param)
Accessor for the TimeZone.

Parameters:
rs - The Result Set
param - The parameter id
Returns:
The TimeZone

setChar

public void setChar(java.lang.Object ps,
                    int param,
                    char value)
Method to set a character at the specified position in the JDBC PreparedStatement.

Specified by:
setChar in interface DatastoreMapping
Overrides:
setChar in class RDBMSMapping
Parameters:
ps - The PreparedStatement
param - Parameter position
value - The value to set

getChar

public char getChar(java.lang.Object rs,
                    int param)
Method to extract a character from the ResultSet at the specified position

Specified by:
getChar in interface DatastoreMapping
Overrides:
getChar in class RDBMSMapping
Parameters:
rs - The Result Set
param - The parameter position
Returns:
the character

setLocale

public void setLocale(java.lang.Object ps,
                      int param,
                      java.util.Locale value)
Method to set a Locale at the specified position in the JDBC PreparedStatement.

Parameters:
ps - The PreparedStatement
param - Parameter position
value - The value to set

getLocale

public java.util.Locale getLocale(java.lang.Object rs,
                                  int param)
Method to extract a Locale from the ResultSet at the specified position

Parameters:
rs - The Result Set
param - The parameter position
Returns:
the Locale

setString

public void setString(java.lang.Object ps,
                      int param,
                      java.lang.String value)
Method to set a String at the specified position in the JDBC PreparedStatement.

Specified by:
setString in interface DatastoreMapping
Overrides:
setString in class RDBMSMapping
Parameters:
ps - The PreparedStatement
param - Parameter position
value - The value to set

getString

public java.lang.String getString(java.lang.Object rs,
                                  int param)
Method to extract a String from the ResultSet at the specified position

Specified by:
getString in interface DatastoreMapping
Overrides:
getString in class RDBMSMapping
Parameters:
rs - The Result Set
param - The parameter position
Returns:
the String

setBoolean

public void setBoolean(java.lang.Object ps,
                       int param,
                       boolean value)
Method to set a boolean at the specified position in the JDBC PreparedStatement.

Specified by:
setBoolean in interface DatastoreMapping
Overrides:
setBoolean in class RDBMSMapping
Parameters:
ps - The PreparedStatement
param - Parameter position
value - The value to set

getBoolean

public boolean getBoolean(java.lang.Object rs,
                          int param)
Method to extract a boolean from the ResultSet at the specified position

Specified by:
getBoolean in interface DatastoreMapping
Overrides:
getBoolean in class RDBMSMapping
Parameters:
rs - The Result Set
param - The parameter position
Returns:
the boolean

setObject

public void setObject(java.lang.Object ps,
                      int param,
                      java.lang.Object value)
Method to set an object at the specified position in the JDBC PreparedStatement.

Specified by:
setObject in interface DatastoreMapping
Overrides:
setObject in class RDBMSMapping
Parameters:
ps - The PreparedStatement
param - Parameter position
value - The value to set

getObject

public java.lang.Object getObject(java.lang.Object rs,
                                  int param)
Method to extract an object from the ResultSet at the specified position

Specified by:
getObject in interface DatastoreMapping
Overrides:
getObject in class RDBMSMapping
Parameters:
rs - The Result Set
param - The parameter position
Returns:
the object


Copyright © -2007 . All Rights Reserved.