com.youyounet.db
Class Column

java.lang.Object
  |
  +--com.youyounet.db.Column

public class Column
extends java.lang.Object

Column is a help class that encapsulate the information needed to map a Data Bean's property to a database table column.


Field Summary
protected  java.lang.reflect.Field beanProperty
           
protected  ColumnAttribute columnAttribute
           
protected  int columnType
           
 
Constructor Summary
Column(java.lang.reflect.Field beanProperty, ColumnAttribute columnAttribute)
          public constructor
 
Method Summary
 java.lang.reflect.Field getBeanProperty()
          Get the value of bean Property.
 ColumnAttribute getColumnAttribute()
          Get the value of ColumnAttribute
 int getColumnAttributeValue()
          Get the attributeValue of the columnAttribute
 java.lang.String getColumnName()
          Get the database table column name
 int getColumnType()
          Get the value of columnType
static int getColumnType(java.lang.String c)
          A static method that takes a Java type name as parameter and returns the corresponding interger value defined in class DataType
protected  boolean loadProperty(java.sql.ResultSet result, java.lang.Object obj)
          Set the obj's property corresponding to this column to the specified ResultSet's value.
protected  boolean loadProperty(java.sql.ResultSet result, java.lang.Object obj, int index)
          Set the obj's property corresponding to this column to the specified ResultSet's value.
static void setPSVariable(java.sql.PreparedStatement pstmt, java.lang.Object obj, int index)
          Set a PreparedStatement's value corresponding to this column to the specified obj's property value
static void setPSVariableNull(java.sql.PreparedStatement pstmt, int sqlType, int index)
          Set a PreparedStatement's value corresponding to this column to null
protected  void setVariable(java.sql.PreparedStatement pstmt, java.lang.Object obj, int index)
          Set a PreparedStatement's value corresponding to this column to the specified obj's property value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beanProperty

protected java.lang.reflect.Field beanProperty

columnAttribute

protected ColumnAttribute columnAttribute

columnType

protected int columnType
Constructor Detail

Column

public Column(java.lang.reflect.Field beanProperty,
              ColumnAttribute columnAttribute)
public constructor

Parameters:
beanProperty - java.lang.reflect.Field typed bean property used to map to this column
columnAttribute - a parameter of type ColumnAttribute
Method Detail

getColumnType

public static int getColumnType(java.lang.String c)
A static method that takes a Java type name as parameter and returns the corresponding interger value defined in class DataType

Parameters:
c - Java data type name
Returns:
the interger representing the data type of the passed in data type name

getBeanProperty

public java.lang.reflect.Field getBeanProperty()
Get the value of bean Property.


getColumnAttribute

public ColumnAttribute getColumnAttribute()
Get the value of ColumnAttribute


getColumnType

public int getColumnType()
Get the value of columnType


getColumnName

public java.lang.String getColumnName()
Get the database table column name


getColumnAttributeValue

public int getColumnAttributeValue()
Get the attributeValue of the columnAttribute

See Also:
ColumnAttribute

setPSVariableNull

public static void setPSVariableNull(java.sql.PreparedStatement pstmt,
                                     int sqlType,
                                     int index)
                              throws java.sql.SQLException
Set a PreparedStatement's value corresponding to this column to null

Parameters:
pstmt - the PreparedStatement object for which this column's value will be set to null
sqlType - int value corresponding to the Java SQL type of this column
index - index of this column in the database table
Throws:
java.sql.SQLException

setPSVariable

public static void setPSVariable(java.sql.PreparedStatement pstmt,
                                 java.lang.Object obj,
                                 int index)
                          throws java.sql.SQLException,
                                 DataTransferException
Set a PreparedStatement's value corresponding to this column to the specified obj's property value

Parameters:
pstmt - the PreparedStatement object for which this column's value will be set to the specified obj's corresponding property value
index - index of this column in the database table
obj - whose corresponding property value will be used to set the value of the PreparedStatement object
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException

setVariable

protected void setVariable(java.sql.PreparedStatement pstmt,
                           java.lang.Object obj,
                           int index)
                    throws java.sql.SQLException,
                           DataTransferException
Set a PreparedStatement's value corresponding to this column to the specified obj's property value

Parameters:
pstmt - the PreparedStatement object for which this column's value will be set to the specified obj's corresponding property value
index - index of this column in the database table
obj - whose corresponding property value will be used to set the value of the PreparedStatement object
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException

loadProperty

protected boolean loadProperty(java.sql.ResultSet result,
                               java.lang.Object obj)
                        throws java.sql.SQLException,
                               DataTransferException
Set the obj's property corresponding to this column to the specified ResultSet's value.

Parameters:
result - the ResultSet object whose value corresponding to this column will be used to set the specified obj's corresponding property value
obj - whose property value corresponding to this column will be set using the passed in ResultSet object
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException

loadProperty

protected boolean loadProperty(java.sql.ResultSet result,
                               java.lang.Object obj,
                               int index)
                        throws java.sql.SQLException,
                               DataTransferException
Set the obj's property corresponding to this column to the specified ResultSet's value.

Parameters:
result - the ResultSet object whose value corresponding to this column will be used to set the specified obj's corresponding property value
obj - whose property value corresponding to this column will be set using the passed in ResultSet object
index - the index of this column in the table
Throws:
java.sql.SQLException
{@link - DataTransferException}
DataTransferException