com.is.jrf
Class IntegerColumnSpec

java.lang.Object
  |
  +--com.is.jrf.AbstractColumnSpec
        |
        +--com.is.jrf.IntegerColumnSpec
All Implemented Interfaces:
ColumnSpec, JRFConstants

public class IntegerColumnSpec
extends AbstractColumnSpec

This subclass of AbstractColumnSpec does Integer-specific things.


Field Summary
protected static java.lang.Class s_class
           
 
Fields inherited from class com.is.jrf.AbstractColumnSpec
EQUALS, i_columnName, i_default, i_getter, i_naturalPrimaryKey, i_optimisticLock, i_required, i_sequencedPrimaryKey, i_setter, i_subtypeIdentifier, i_unique, NOT_EQUALS
 
Fields inherited from interface com.is.jrf.JRFConstants
CURRENT_DATE, CURRENT_TIMESTAMP, DEFAULT_TO_EMPTY_STRING, DEFAULT_TO_FALSE, DEFAULT_TO_NOW, DEFAULT_TO_NULL, DEFAULT_TO_ONE, DEFAULT_TO_TODAY, DEFAULT_TO_TRUE, DEFAULT_TO_ZERO, NATURAL_PRIMARY_KEY, NO_POST_FIND, OPTIMISTIC_LOCK, REQUIRED, SEQUENCED_PRIMARY_KEY, SUBTYPE_IDENTIFIER, UNIQUE
 
Constructor Summary
IntegerColumnSpec(java.lang.String columnName, java.lang.String getter, java.lang.String setter, java.lang.Object defaultValue)
           
IntegerColumnSpec(java.lang.String columnName, java.lang.String getter, java.lang.String setter, java.lang.Object defaultValue, int option1)
           
IntegerColumnSpec(java.lang.String columnName, java.lang.String getter, java.lang.String setter, java.lang.Object defaultValue, int option1, int option2)
           
IntegerColumnSpec(java.lang.String columnName, java.lang.String getter, java.lang.String setter, java.lang.Object defaultValue, int option1, int option2, int option3)
           
 
Method Summary
 JoinColumn buildJoinColumn()
           
 java.lang.Object decode(java.lang.String aString)
          This method goes with encode().
 java.lang.String formatForSql(java.lang.Object obj, DatabasePolicy dbPolicy)
          This method overrides the superclass implementation.
 java.lang.Class getColumnClass()
          See IntegerColumnSpec for example of how to implement:
 java.lang.Object getColumnValueFrom(JDBCHelper helper)
          This ensures we get an Integer (instead of a BigInteger or something else) from the JDBC driver.
 java.lang.String getSQLColumnType(DatabasePolicy dbPolicy)
          Return the ANSI standard SQL column type.
 java.lang.Object optimisticLockDefaultValue()
          Unless this is overridden, an exception will be thrown.
 void setValueTo(java.lang.Object aValue, PersistentObject aPO)
          This is an override that converts Longs into Integers.
 
Methods inherited from class com.is.jrf.AbstractColumnSpec
buildNameValuePair, buildWhereClause, columnDefinitionString, copyAttribute, copyColumnValueToPersistentObject, decodeToPersistentObject, encode, encodeFromPersistentObject, getColumnName, getDefault, getFullyQualifiedColumnName, getGetter, getSetter, getSqlValueFrom, getValueFrom, getValueFrom, isNaturalPrimaryKey, isOptimisticLock, isPrimaryKey, isRequired, isSequencedPrimaryKey, isSubtypeIdentifier, isUnique, setRequired, setValueTo, validateRequired, validateUnique, validateUnique
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_class

protected static final java.lang.Class s_class
Constructor Detail

IntegerColumnSpec

public IntegerColumnSpec(java.lang.String columnName,
                         java.lang.String getter,
                         java.lang.String setter,
                         java.lang.Object defaultValue)

IntegerColumnSpec

public IntegerColumnSpec(java.lang.String columnName,
                         java.lang.String getter,
                         java.lang.String setter,
                         java.lang.Object defaultValue,
                         int option1)

IntegerColumnSpec

public IntegerColumnSpec(java.lang.String columnName,
                         java.lang.String getter,
                         java.lang.String setter,
                         java.lang.Object defaultValue,
                         int option1,
                         int option2)

IntegerColumnSpec

public IntegerColumnSpec(java.lang.String columnName,
                         java.lang.String getter,
                         java.lang.String setter,
                         java.lang.Object defaultValue,
                         int option1,
                         int option2,
                         int option3)
Method Detail

formatForSql

public java.lang.String formatForSql(java.lang.Object obj,
                                     DatabasePolicy dbPolicy)
This method overrides the superclass implementation.
Overrides:
formatForSql in class AbstractColumnSpec
Parameters:
obj - a value of type 'Object'
dbPolicy - a value of type 'DatabasePolicy'
Returns:
a value of type 'String'

getColumnClass

public java.lang.Class getColumnClass()
Description copied from class: AbstractColumnSpec
See IntegerColumnSpec for example of how to implement:
Overrides:
getColumnClass in class AbstractColumnSpec

getColumnValueFrom

public java.lang.Object getColumnValueFrom(JDBCHelper helper)
                                    throws java.sql.SQLException
This ensures we get an Integer (instead of a BigInteger or something else) from the JDBC driver.
Overrides:
getColumnValueFrom in class AbstractColumnSpec
Parameters:
helper - a value of type 'JDBCHelper'
Returns:
a value of type 'Object'
Throws:
java.sql.SQLException - if an error occurs

decode

public java.lang.Object decode(java.lang.String aString)
This method goes with encode(). The String parameter must have been created by the encode() method.
Overrides:
decode in class AbstractColumnSpec
Parameters:
aString - a value of type 'String'
aPO - a value of type 'PersistentObject'

getSQLColumnType

public java.lang.String getSQLColumnType(DatabasePolicy dbPolicy)
Return the ANSI standard SQL column type.
Overrides:
getSQLColumnType in class AbstractColumnSpec
Parameters:
dbPolicy - a value of type 'DatabasePolicy'
Returns:
a value of type 'String'

setValueTo

public void setValueTo(java.lang.Object aValue,
                       PersistentObject aPO)
This is an override that converts Longs into Integers. This is needed for sequenced primary keys that are Integers.
Overrides:
setValueTo in class AbstractColumnSpec
Parameters:
aValue - a value of type 'Object'
aPO - a value of type 'PersistentObject'

optimisticLockDefaultValue

public java.lang.Object optimisticLockDefaultValue()
Description copied from class: AbstractColumnSpec
Unless this is overridden, an exception will be thrown.
Overrides:
optimisticLockDefaultValue in class AbstractColumnSpec
Following copied from class: com.is.jrf.AbstractColumnSpec
Returns:
a value of type 'Object'

buildJoinColumn

public JoinColumn buildJoinColumn()
Overrides:
buildJoinColumn in class AbstractColumnSpec
Following copied from class: com.is.jrf.AbstractColumnSpec
Returns:
a JoinColumn subclass instance with data from myself.