com.ibatis.sqlmap.engine.type
Interface TypeHandler

All Known Implementing Classes:
BaseTypeHandler, BigDecimalTypeHandler, BooleanTypeHandler, ByteArrayTypeHandler, ByteTypeHandler, CustomTypeHandler, DateOnlyTypeHandler, DateTypeHandler, DoubleTypeHandler, FloatTypeHandler, IntegerTypeHandler, LongTypeHandler, ObjectTypeHandler, ShortTypeHandler, SqlDateTypeHandler, SqlTimestampTypeHandler, SqlTimeTypeHandler, StringTypeHandler, TimeOnlyTypeHandler, UnknownTypeHandler

public interface TypeHandler

Interface for getting data into, and out of a mapped statement


Method Summary
 boolean equals(java.lang.Object object, java.lang.String string)
          Compares two values (that this handler deals with) for equality
 java.lang.Object getResult(java.sql.CallableStatement cs, int columnIndex)
          Gets a column from a callable statement
 java.lang.Object getResult(java.sql.ResultSet rs, int columnIndex)
          Gets a column from a result set
 java.lang.Object getResult(java.sql.ResultSet rs, java.lang.String columnName)
          Gets a column from a result set
 void setParameter(java.sql.PreparedStatement ps, int i, java.lang.Object parameter, java.lang.String jdbcType)
          Sets a parameter on a prepared statement
 java.lang.Object valueOf(java.lang.String s)
          Converts the String to the type that this handler deals with
 

Method Detail

setParameter

public void setParameter(java.sql.PreparedStatement ps,
                         int i,
                         java.lang.Object parameter,
                         java.lang.String jdbcType)
                  throws java.sql.SQLException
Sets a parameter on a prepared statement

Parameters:
ps - - the prepared statement
i - - the parameter index
parameter - - the parameter value
jdbcType - - the JDBC type of the parameter
Throws:
java.sql.SQLException - if setting the parameter fails

getResult

public java.lang.Object getResult(java.sql.ResultSet rs,
                                  java.lang.String columnName)
                           throws java.sql.SQLException
Gets a column from a result set

Parameters:
rs - - the result set
columnName - - the column name to get
Returns:
- the column value
Throws:
java.sql.SQLException - if getting the value fails

getResult

public java.lang.Object getResult(java.sql.ResultSet rs,
                                  int columnIndex)
                           throws java.sql.SQLException
Gets a column from a result set

Parameters:
rs - - the result set
columnIndex - - the column to get (by index)
Returns:
- the column value
Throws:
java.sql.SQLException - if getting the value fails

getResult

public java.lang.Object getResult(java.sql.CallableStatement cs,
                                  int columnIndex)
                           throws java.sql.SQLException
Gets a column from a callable statement

Parameters:
cs - - the statement
columnIndex - - the column to get (by index)
Returns:
- the column value
Throws:
java.sql.SQLException - if getting the value fails

valueOf

public java.lang.Object valueOf(java.lang.String s)
Converts the String to the type that this handler deals with

Parameters:
s - - the String value
Returns:
- the converted value

equals

public boolean equals(java.lang.Object object,
                      java.lang.String string)
Compares two values (that this handler deals with) for equality

Parameters:
object - - one of the objects
string - - the other object as a String
Returns:
- true if they are equal