public class ScalarTypeEnumWithMapping extends ScalarTypeEnumStandard.EnumBase implements ScalarType, ScalarTypeEnum
enumTypejdbcNative, jdbcType, type| Constructor and Description |
|---|
ScalarTypeEnumWithMapping(EnumToDbValueMap<?> beanDbMap,
Class<?> enumType,
int length)
Create with an explicit mapping of bean to database values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bind(DataBind b,
Object value)
Convert (if necessary) and bind the value to the preparedStatement.
|
String |
getContraintInValues()
Return the IN values for DB constraint construction.
|
int |
getLength()
Return the DB column length for storing the enum value.
|
Object |
read(DataReader dataReader)
Read the value from the resultSet and convert if necessary to the logical
bean property value.
|
Object |
toBeanType(Object dbValue)
Convert the value as necessary to the logical Bean type.
|
Object |
toJdbcType(Object beanValue)
Convert the value as necessary to the JDBC type.
|
format, formatValue, isDateTimeCapable, jsonFromString, jsonToString, parse, parseDateTime, readData, writeDataaccumulateScalarTypes, getDbNullValue, getJdbcType, getType, isDbNull, isJdbcNative, jsonWrite, loadIgnoreclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitformat, formatValue, getJdbcType, getType, isDateTimeCapable, isJdbcNative, jsonFromString, jsonToString, jsonWrite, loadIgnore, parse, parseDateTime, readData, writeDataaccumulateScalarTypespublic ScalarTypeEnumWithMapping(EnumToDbValueMap<?> beanDbMap, Class<?> enumType, int length)
public String getContraintInValues()
getContraintInValues in interface ScalarTypeEnumpublic int getLength()
This is for enum's mapped to strings.
getLength in interface ScalarTypegetLength in class ScalarTypeBasepublic void bind(DataBind b, Object value) throws SQLException
ScalarTypevalue may need to be converted from the logical bean property type to the JDBC type.
bind in interface ScalarDataReaderbind in interface ScalarTypeSQLExceptionpublic Object read(DataReader dataReader) throws SQLException
ScalarTyperead in interface ScalarDataReaderread in interface ScalarTypeSQLExceptionpublic Object toBeanType(Object dbValue)
ScalarTypeThe type as per the bean property.
This is used to automatically convert id values (typically from a string to a int, long or UUID).
toBeanType in interface ScalarTypepublic Object toJdbcType(Object beanValue)
ScalarTypeNote that this should also match the type as per the getJdbcType() method.
This is typically used when the matching type is used in a where clause and we use this to ensure it is an appropriate jdbc type.
toJdbcType in interface ScalarTypeCopyright © 2014. All Rights Reserved.