sqlg2
Class ColumnInfo

java.lang.Object
  extended by sqlg2.ColumnInfo

public final class ColumnInfo
extends java.lang.Object

Description of DB-to-Java mapping for one column of a result set.


Constructor Summary
ColumnInfo(java.lang.Class<?> type, java.lang.String name, java.lang.String fetchMethod, boolean special)
          Constructor.
 
Method Summary
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnInfo

public ColumnInfo(java.lang.Class<?> type,
                  java.lang.String name,
                  java.lang.String fetchMethod,
                  boolean special)
Constructor.

Parameters:
type - type of the Java field for this DB column
name - name of the Java field for this DB column
fetchMethod - method to retrieve info from result set for this DB column. It is a string containing full text of a call using resultSetVar and metaVar parameters of Mapper.getFields(java.sql.ResultSetMetaData, String, String, sqlg2.checker.SqlChecker) method.

Example: to retrieve int value from the first column of a result set you can create following string for fetchMethod value:

 String metaMethod = resultSetVar + ".getMetaData().getPrecision(1)";
String dataMethod = resultSetVar + ".getInt(1)";
String fetchMethod = metaVar + " ? " + metaMethod + " : " + dataMethod;

Normally you would use sqlg2.db.Impl methods to retrieve data/meta-data from result set.

special - true if it is a mapping to MappedType, not ordinary Java class.
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object