Package io.ebeaninternal.server.type
Class ScalarTypeDate
- java.lang.Object
-
- io.ebeaninternal.server.type.ScalarTypeBase<T>
-
- io.ebeaninternal.server.type.ScalarTypeBaseDate<Date>
-
- io.ebeaninternal.server.type.ScalarTypeDate
-
- All Implemented Interfaces:
StringFormatter
,StringParser
,ScalarDataReader<Date>
,ScalarType<Date>
public class ScalarTypeDate extends ScalarTypeBaseDate<Date>
ScalarType for java.sql.Date.
-
-
Constructor Summary
Constructors Constructor Description ScalarTypeDate(JsonConfig.Date mode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind(DataBind b, Date value)
Convert (if necessary) and bind the value to the preparedStatement.Date
convertFromDate(Date date)
Convert from java.sql.Date to the target Date type.Date
convertToDate(Date t)
Convert to java.sql.Date from the target Date type.long
convertToMillis(Date value)
Convert the target value to millis.Date
read(DataReader dataReader)
Read the value from the resultSet and convert if necessary to the logical bean property value.Date
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.-
Methods inherited from class io.ebeaninternal.server.type.ScalarTypeBaseDate
convertFromMillis, formatValue, getDocType, isDateTimeCapable, jsonRead, jsonWrite, parse, readData, writeData
-
Methods inherited from class io.ebeaninternal.server.type.ScalarTypeBase
asVersion, format, getJdbcType, getLength, getType, isBinaryType, isDirty, isJdbcNative, isMutable, loadIgnore
-
-
-
-
Constructor Detail
-
ScalarTypeDate
public ScalarTypeDate(JsonConfig.Date mode)
-
-
Method Detail
-
convertToMillis
public long convertToMillis(Date value)
Description copied from class:ScalarTypeBaseDate
Convert the target value to millis.- Specified by:
convertToMillis
in classScalarTypeBaseDate<Date>
-
convertFromDate
public Date convertFromDate(Date date)
Description copied from class:ScalarTypeBaseDate
Convert from java.sql.Date to the target Date type.- Specified by:
convertFromDate
in classScalarTypeBaseDate<Date>
-
convertToDate
public Date convertToDate(Date t)
Description copied from class:ScalarTypeBaseDate
Convert to java.sql.Date from the target Date type.- Specified by:
convertToDate
in classScalarTypeBaseDate<Date>
-
bind
public void bind(DataBind b, Date value) throws SQLException
Description copied from interface:ScalarType
Convert (if necessary) and bind the value to the preparedStatement.value may need to be converted from the logical bean property type to the JDBC type.
- Specified by:
bind
in interfaceScalarType<Date>
- Overrides:
bind
in classScalarTypeBaseDate<Date>
- Throws:
SQLException
-
read
public Date read(DataReader dataReader) throws SQLException
Description copied from interface:ScalarType
Read the value from the resultSet and convert if necessary to the logical bean property value.- Specified by:
read
in interfaceScalarDataReader<Date>
- Specified by:
read
in interfaceScalarType<Date>
- Overrides:
read
in classScalarTypeBaseDate<Date>
- Throws:
SQLException
-
toJdbcType
public Object toJdbcType(Object value)
Description copied from interface:ScalarType
Convert the value as necessary to the JDBC type.Note 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.
-
toBeanType
public Date toBeanType(Object value)
Description copied from interface:ScalarType
Convert the value as necessary to the logical Bean type.The type as per the bean property.
This is used to automatically convert id values (typically from a string to a int, long or UUID).
-
-