public abstract class EnumToDbValueMap<T> extends Object
Useful for building Enum converters where you want to map the DB values an Enum gets converter to.
| Constructor and Description |
|---|
EnumToDbValueMap()
Construct with allowNulls defaulting to false.
|
EnumToDbValueMap(boolean allowNulls,
boolean isIntegerType)
Construct with allowNulls setting.
|
| Modifier and Type | Method and Description |
|---|---|
abstract EnumToDbValueMap<T> |
add(Object beanValue,
String dbValue)
Add name value pair where the dbValue is the raw string and may need to
be converted (to an Integer for example).
|
protected void |
addInternal(Object beanValue,
T dbValue)
Add a bean value and DB value pair.
|
Iterator<Object> |
beanValues()
Return the bean 'key' value.
|
abstract void |
bind(DataBind b,
Object value)
Bind using the correct database type.
|
static EnumToDbValueMap<?> |
create(boolean integerType) |
Iterator<T> |
dbValues()
Return the DB values.
|
Object |
getBeanValue(T dbValue)
Return the Bean value given the DB value.
|
abstract int |
getDbType()
Return the database type.
|
T |
getDbValue(Object beanValue)
Return the DB value given the bean value.
|
boolean |
isIntegerType()
Return true if this is mapping to integers, false
if mapping to Strings.
|
abstract Object |
read(DataReader dataReader)
Read using the correct database type.
|
public EnumToDbValueMap()
public EnumToDbValueMap(boolean allowNulls,
boolean isIntegerType)
If allowNulls is false then an IllegalArgumentException is thrown by either the getDBValue or getBeanValue methods if not matching Bean or DB value is found.
public static EnumToDbValueMap<?> create(boolean integerType)
public boolean isIntegerType()
public abstract void bind(DataBind b, Object value) throws SQLException
SQLExceptionpublic abstract Object read(DataReader dataReader) throws SQLException
SQLExceptionpublic abstract int getDbType()
public abstract EnumToDbValueMap<T> add(Object beanValue, String dbValue)
protected void addInternal(Object beanValue, T dbValue)
The dbValue will be converted to an Integer if isIntegerType is true;
Copyright © 2014. All Rights Reserved.