public abstract class ScalarTypeBaseVarchar<T> extends ScalarTypeBase<T>
jdbcNative, jdbcType, type| Constructor and Description |
|---|
ScalarTypeBaseVarchar(Class<T> type) |
ScalarTypeBaseVarchar(Class<T> type,
boolean jdbcNative,
int jdbcType) |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(DataBind b,
T value)
Convert (if necessary) and bind the value to the preparedStatement.
|
abstract T |
convertFromDbString(String dbValue) |
abstract String |
convertToDbString(T beanValue) |
String |
format(Object v)
Convert the type into a string representation.
|
abstract String |
formatValue(T v)
Convert the type into a string representation.
|
boolean |
isDateTimeCapable()
Return true if the type can accept long systemTimeMillis input.
|
T |
jsonFromString(String value,
JsonValueAdapter ctx) |
void |
jsonWrite(WriteJsonBuffer buffer,
T value,
JsonValueAdapter ctx) |
abstract T |
parse(String value)
Convert the string value to the appropriate java object.
|
T |
parseDateTime(long systemTimeMillis)
Convert the systemTimeMillis into the appropriate java object.
|
T |
read(DataReader dataReader)
Read the value from the resultSet and convert if necessary to the logical
bean property value.
|
Object |
readData(DataInput dataInput) |
T |
toBeanType(Object value)
Convert the value as necessary to the logical Bean type.
|
Object |
toJdbcType(Object value)
Convert the value as necessary to the JDBC type.
|
String |
toJsonString(Object value,
JsonValueAdapter ctx) |
void |
writeData(DataOutput dataOutput,
Object v) |
accumulateScalarTypes, getDbNullValue, getJdbcType, getLength, getType, isDbNull, isJdbcNative, jsonToString, loadIgnorepublic abstract String formatValue(T v)
ScalarTypeReciprocal of parse().
public abstract T parse(String value)
ScalarTypeMostly used to support CSV, JSON and XML parsing.
Reciprocal of formatValue().
public void bind(DataBind b, T value) throws SQLException
ScalarTypevalue may need to be converted from the logical bean property type to the JDBC type.
SQLExceptionpublic T read(DataReader dataReader) throws SQLException
ScalarTypeSQLExceptionpublic T toBeanType(Object value)
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).
public Object toJdbcType(Object value)
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.
public T parseDateTime(long systemTimeMillis)
ScalarTypeFor non dateTime types this will throw an exception.
public boolean isDateTimeCapable()
ScalarType
This is used to determine if is is sensible to use the
ScalarType.parseDateTime(long) method.
This includes the Date, Calendar, sql Date, Time, Timestamp, JODA types as well as Long, BigDecimal and String (although it generally is not expected to parse systemTimeMillis to a String or BigDecimal).
public String format(Object v)
ScalarTypeThis assumes the value is of the correct type.
This is so that ScalarType also implements the StringFormatter interface.
format in interface StringFormatterformat in interface ScalarType<T>format in class ScalarTypeBase<T>public T jsonFromString(String value, JsonValueAdapter ctx)
jsonFromString in interface ScalarType<T>jsonFromString in class ScalarTypeBase<T>public String toJsonString(Object value, JsonValueAdapter ctx)
public void jsonWrite(WriteJsonBuffer buffer, T value, JsonValueAdapter ctx)
jsonWrite in interface ScalarType<T>jsonWrite in class ScalarTypeBase<T>public Object readData(DataInput dataInput) throws IOException
IOExceptionpublic void writeData(DataOutput dataOutput, Object v) throws IOException
IOExceptionCopyright © 2014. All Rights Reserved.