TYPE - The Java type represented by the column.public class GenericColumn<TYPE> extends Object
     Hrorm has a number of built in types that users can access directly from
     their static instance variables of this class.
     But users can also easily extend hrorm to support whatever column types they wish.
     To create an instance of this class, the caller must provide a mechanism for setting the
     type's value onto a java.sql.PreparedStatement,
     a mechanism for reading a value from a java.sql.ResultSet,
     and the type of the column, as given in java.sql.Types.
 
      For example, to create a column for Integer, do the following:
 
 GenericColumn<Integer> integerColumn = new GenericColumn<>(
     PreparedStatement::setInt,
     ResultSet::getInt,
     java.sql.Types.Integer);
 
     Note that GenericColumn.Integer is essentially that and can
     simply be used directly.
 
 Using a custom GenericColumn is easy, as shown in the example above,
 but greater care must be taken when using hrorm's facilities for validation (Validator)
 or schema generation (Schema). For example, users may wish to create multiple instances of
 this class that all support float member variables, if there are a variety
 of sizes of columns in their database, all represented by different SQL variable types.
 
| Modifier and Type | Field and Description | 
|---|---|
| static GenericColumn<BigDecimal> | BIG_DECIMALAn instance that supports  BigDecimaldata elements. | 
| static GenericColumn<Boolean> | BOOLEANAn instance that supports  Booleanorbooleandata elements. | 
| static GenericColumn<Byte> | BYTEAn instance that supports  Byteorbytedata elements. | 
| static GenericColumn<Double> | DOUBLEAn instance that supports  Doubleordoubledata elements. | 
| static GenericColumn<Float> | FLOATAn instance that supports  Floatorfloatdata elements. | 
| static GenericColumn<Integer> | INTEGERAn instance that supports  Integerorintdata elements. | 
| static GenericColumn<Long> | LONGAn instance that supports  Longorlongdata elements. | 
| static GenericColumn<String> | STRINGAn instance that supports  Stringdata elements. | 
| static GenericColumn<Timestamp> | TIMESTAMPAn instance that supports  Timestampdata elements. | 
| Constructor and Description | 
|---|
| GenericColumn(org.hrorm.PreparedStatementSetter<TYPE> preparedStatementSetter,
             ResultSetReader<TYPE> resultReader,
             int sqlType)Create a generic column instance to support the  TYPE. | 
| GenericColumn(org.hrorm.PreparedStatementSetter<TYPE> preparedStatementSetter,
             ResultSetReader<TYPE> resultReader,
             int sqlType,
             String sqlTypeName)Create a generic column instance to support the  TYPE. | 
| GenericColumn(org.hrorm.PreparedStatementSetter<TYPE> preparedStatementSetter,
             ResultSetReader<TYPE> resultReader,
             int sqlType,
             String sqlTypeName,
             Set<Integer> supportedTypes)Create a generic column instance to support the  TYPE. | 
| Modifier and Type | Method and Description | 
|---|---|
| TYPE | fromResultSet(ResultSet resultSet,
             String columnName) | 
| String | getSqlTypeName() | 
| Set<Integer> | getSupportedTypes() | 
| void | setPreparedStatement(PreparedStatement preparedStatement,
                    int index,
                    TYPE value) | 
| int | sqlType() | 
public static GenericColumn<Long> LONG
Long or long data elements.public static GenericColumn<BigDecimal> BIG_DECIMAL
BigDecimal data elements.public static GenericColumn<Boolean> BOOLEAN
Boolean or boolean data elements.public static GenericColumn<String> STRING
String data elements.public static GenericColumn<Timestamp> TIMESTAMP
Timestamp data elements.public static GenericColumn<Integer> INTEGER
Integer or int data elements.public static GenericColumn<Byte> BYTE
Byte or byte data elements.public static GenericColumn<Float> FLOAT
Float or float data elements.public static GenericColumn<Double> DOUBLE
Double or double data elements.public GenericColumn(org.hrorm.PreparedStatementSetter<TYPE> preparedStatementSetter, ResultSetReader<TYPE> resultReader, int sqlType)
TYPE.preparedStatementSetter - The method used to set the type onto a prepared statement.resultReader - The method used to read the value out of a result set.sqlType - The kind of this column type, as defined in java.sql.Typespublic GenericColumn(org.hrorm.PreparedStatementSetter<TYPE> preparedStatementSetter, ResultSetReader<TYPE> resultReader, int sqlType, String sqlTypeName)
TYPE.preparedStatementSetter - The method used to set the type onto a prepared statement.resultReader - The method used to read the value out of a result set.sqlType - The kind of this column type, as defined in java.sql.TypessqlTypeName - The name of the type in the SQL schema. This optional value can be set
                    if you wish to generate your schema using a Schema object.public GenericColumn(org.hrorm.PreparedStatementSetter<TYPE> preparedStatementSetter, ResultSetReader<TYPE> resultReader, int sqlType, String sqlTypeName, Set<Integer> supportedTypes)
TYPE.preparedStatementSetter - The method used to set the type onto a prepared statement.resultReader - The method used to read the value out of a result set.sqlType - The kind of this column type, as defined in java.sql.TypessqlTypeName - The name of the type in the SQL schema. This optional value can be set
                    if you wish to generate your schema using a Schema object.supportedTypes - All the database types, as defined in java.sql.Types
                       that this column can support.public TYPE fromResultSet(ResultSet resultSet, String columnName) throws SQLException
SQLExceptionpublic void setPreparedStatement(PreparedStatement preparedStatement, int index, TYPE value) throws SQLException
SQLExceptionpublic int sqlType()
public String getSqlTypeName()
Copyright © 2019. All rights reserved.