org.mentabean
Interface DBType<E>

All Known Implementing Classes:
AutoIncrementType, AutoTimestampType, BigDecimalType, BooleanIntType, BooleanStringType, BooleanType, ByteArrayType, DateType, DoubleType, EnumIdType, EnumValueType, FloatType, GenericType, IntegerType, LongType, NowOnInsertAndUpdateTimestampType, NowOnInsertTimestampType, NowOnUpdateTimestampType, SequenceType, StringType, TimestampType, TimeType

public interface DBType<E>

An interface defining a database type. You can add more database types by implementing this interface.

Author:
sergio.oliveira.jr@gmail.com

Method Summary
 void bindToStmt(PreparedStatement stmt, int index, E value)
          Do what you have to do to bind a value to a prepared statement.
 boolean canBeNull()
          Returns whether this type can be NULL in the database.
 String getAnsiType()
          Return the best ANSI type for this database type.
 E getFromResultSet(ResultSet rset, int index)
          Do what you have to do to get and return this database type from a result set.
 E getFromResultSet(ResultSet rset, String field)
          Do what you have to do to get and return this database type from a result set.
 Class<? extends Object> getTypeClass()
          Return the java type representing this database type.
 

Method Detail

getFromResultSet

E getFromResultSet(ResultSet rset,
                   int index)
                   throws SQLException
Do what you have to do to get and return this database type from a result set.

Parameters:
rset - The result set
index - The index in the result set
Returns:
The value from the result set
Throws:
SQLException

bindToStmt

void bindToStmt(PreparedStatement stmt,
                int index,
                E value)
                throws SQLException
Do what you have to do to bind a value to a prepared statement.

Parameters:
stmt - The prepared statement
index - The index in the prepared statement
value - The value to be bound to the prepared statement
Throws:
SQLException

getFromResultSet

E getFromResultSet(ResultSet rset,
                   String field)
                   throws SQLException
Do what you have to do to get and return this database type from a result set.

Parameters:
rset - The result set
field - The name of the field in the result set
Returns:
The value from the result set
Throws:
SQLException

getTypeClass

Class<? extends Object> getTypeClass()
Return the java type representing this database type.

Returns:
The java type of this database type.

canBeNull

boolean canBeNull()
Returns whether this type can be NULL in the database. This is used by the session.createTable() method.

Returns:
true if field can be NULL in the database.

getAnsiType

String getAnsiType()
Return the best ANSI type for this database type. This is used by the session.createTable() method.

Returns:
the ANSI type for this database type.


Copyright © 2013. All Rights Reserved.