org.mentabean.type
Class EnumValueType

java.lang.Object
  extended by org.mentabean.type.EnumValueType
All Implemented Interfaces:
DBType<Enum<?>>, SizedType

public class EnumValueType
extends Object
implements DBType<Enum<?>>, SizedType


Field Summary
 
Fields inherited from interface org.mentabean.type.SizedType
DEFAULT_SIZE
 
Constructor Summary
EnumValueType(Class<? extends Enum<?>> enumType)
           
 
Method Summary
 void bindToStmt(PreparedStatement stmt, int index, Enum<?> 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.
 Enum<?> getFromResultSet(ResultSet rset, int index)
          Do what you have to do to get and return this database type from a result set.
 Enum<?> getFromResultSet(ResultSet rset, String field)
          Do what you have to do to get and return this database type from a result set.
 int getSize()
           
 Class<? extends Object> getTypeClass()
          Return the java type representing this database type.
 EnumValueType nullable(boolean flag)
           
 EnumValueType size(int size)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnumValueType

public EnumValueType(Class<? extends Enum<?>> enumType)
Method Detail

canBeNull

public boolean canBeNull()
Description copied from interface: DBType
Returns whether this type can be NULL in the database. This is used by the session.createTable() method.

Specified by:
canBeNull in interface DBType<Enum<?>>
Returns:
true if field can be NULL in the database.

nullable

public EnumValueType nullable(boolean flag)

getAnsiType

public String getAnsiType()
Description copied from interface: DBType
Return the best ANSI type for this database type. This is used by the session.createTable() method.

Specified by:
getAnsiType in interface DBType<Enum<?>>
Returns:
the ANSI type for this database type.

size

public EnumValueType size(int size)

getSize

public int getSize()
Specified by:
getSize in interface SizedType

toString

public String toString()
Overrides:
toString in class Object

getFromResultSet

public Enum<?> getFromResultSet(ResultSet rset,
                                int index)
                         throws SQLException
Description copied from interface: DBType
Do what you have to do to get and return this database type from a result set.

Specified by:
getFromResultSet in interface DBType<Enum<?>>
Parameters:
rset - The result set
index - The index in the result set
Returns:
The value from the result set
Throws:
SQLException

getFromResultSet

public Enum<?> getFromResultSet(ResultSet rset,
                                String field)
                         throws SQLException
Description copied from interface: DBType
Do what you have to do to get and return this database type from a result set.

Specified by:
getFromResultSet in interface DBType<Enum<?>>
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

public Class<? extends Object> getTypeClass()
Description copied from interface: DBType
Return the java type representing this database type.

Specified by:
getTypeClass in interface DBType<Enum<?>>
Returns:
The java type of this database type.

bindToStmt

public void bindToStmt(PreparedStatement stmt,
                       int index,
                       Enum<?> value)
                throws SQLException
Description copied from interface: DBType
Do what you have to do to bind a value to a prepared statement.

Specified by:
bindToStmt in interface DBType<Enum<?>>
Parameters:
stmt - The prepared statement
index - The index in the prepared statement
value - The value to be bound to the prepared statement
Throws:
SQLException


Copyright © 2013. All Rights Reserved.