Class ScalarTypeUUIDBase
- java.lang.Object
-
- io.ebeaninternal.server.type.ScalarTypeBase<UUID>
-
- io.ebeaninternal.server.type.ScalarTypeUUIDBase
-
- All Implemented Interfaces:
StringFormatter
,StringParser
,ScalarDataReader<UUID>
,ScalarType<UUID>
,ScalarTypeLogicalType
- Direct Known Subclasses:
ScalarTypeUUIDBinary
,ScalarTypeUUIDNative
,ScalarTypeUUIDVarchar
public abstract class ScalarTypeUUIDBase extends ScalarTypeBase<UUID> implements ScalarTypeLogicalType
Base UUID type for string formatting, json handling etc.
-
-
Constructor Summary
Constructors Constructor Description ScalarTypeUUIDBase(boolean jdbcNative, int jdbcType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UUID
convertFromMillis(long dateTime)
Convert the systemTimeMillis into the appropriate java object.String
formatValue(UUID value)
Convert the type into a string representation.DocPropertyType
getDocType()
Return the type this maps to for JSON document stores.int
getLogicalType()
Return the DB agnostic logical type.boolean
isDateTimeCapable()
Return true if the type can accept long systemTimeMillis input.boolean
isDirty(Object value)
Default to true.boolean
isMutable()
Default implementation of mutable false.UUID
jsonRead(com.fasterxml.jackson.core.JsonParser parser)
Read the value from JsonParser.void
jsonWrite(com.fasterxml.jackson.core.JsonGenerator writer, UUID value)
Write the value to the JsonGenerator.UUID
parse(String value)
Convert the string value to the appropriate java object.UUID
readData(DataInput dataInput)
Read the value from binary input.UUID
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.void
writeData(DataOutput dataOutput, UUID value)
Write the value to binary output.-
Methods inherited from class io.ebeaninternal.server.type.ScalarTypeBase
asVersion, format, getJdbcType, getLength, getType, isBinaryType, isJdbcNative, loadIgnore
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.ebeaninternal.server.type.ScalarType
bind, read
-
-
-
-
Constructor Detail
-
ScalarTypeUUIDBase
public ScalarTypeUUIDBase(boolean jdbcNative, int jdbcType)
-
-
Method Detail
-
getLogicalType
public int getLogicalType()
Description copied from interface:ScalarTypeLogicalType
Return the DB agnostic logical type.- Specified by:
getLogicalType
in interfaceScalarTypeLogicalType
-
isMutable
public boolean isMutable()
Description copied from class:ScalarTypeBase
Default implementation of mutable false.- Specified by:
isMutable
in interfaceScalarType<UUID>
- Overrides:
isMutable
in classScalarTypeBase<UUID>
-
isDirty
public boolean isDirty(Object value)
Description copied from class:ScalarTypeBase
Default to true.- Specified by:
isDirty
in interfaceScalarType<UUID>
- Overrides:
isDirty
in classScalarTypeBase<UUID>
-
formatValue
public String formatValue(UUID value)
Description copied from interface:ScalarType
Convert the type into a string representation.Reciprocal of parse().
- Specified by:
formatValue
in interfaceScalarType<UUID>
-
parse
public UUID parse(String value)
Description copied from interface:ScalarType
Convert the string value to the appropriate java object.Mostly used to support CSV, JSON and XML parsing.
Reciprocal of formatValue().
- Specified by:
parse
in interfaceScalarType<UUID>
- Specified by:
parse
in interfaceStringParser
-
convertFromMillis
public UUID convertFromMillis(long dateTime)
Description copied from interface:ScalarType
Convert the systemTimeMillis into the appropriate java object.For non dateTime types this will throw an exception.
- Specified by:
convertFromMillis
in interfaceScalarType<UUID>
-
isDateTimeCapable
public boolean isDateTimeCapable()
Description copied from interface:ScalarType
Return true if the type can accept long systemTimeMillis input.This is used to determine if is is sensible to use the
ScalarType.convertFromMillis(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).
- Specified by:
isDateTimeCapable
in interfaceScalarType<UUID>
-
toBeanType
public UUID 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).
- Specified by:
toBeanType
in interfaceScalarType<UUID>
-
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.
- Specified by:
toJdbcType
in interfaceScalarType<UUID>
-
readData
public UUID readData(DataInput dataInput) throws IOException
Description copied from interface:ScalarType
Read the value from binary input.- Specified by:
readData
in interfaceScalarType<UUID>
- Throws:
IOException
-
writeData
public void writeData(DataOutput dataOutput, UUID value) throws IOException
Description copied from interface:ScalarType
Write the value to binary output.- Specified by:
writeData
in interfaceScalarType<UUID>
- Throws:
IOException
-
jsonWrite
public void jsonWrite(com.fasterxml.jackson.core.JsonGenerator writer, UUID value) throws IOException
Description copied from interface:ScalarType
Write the value to the JsonGenerator.- Specified by:
jsonWrite
in interfaceScalarType<UUID>
- Throws:
IOException
-
jsonRead
public UUID jsonRead(com.fasterxml.jackson.core.JsonParser parser) throws IOException
Description copied from interface:ScalarType
Read the value from JsonParser.- Specified by:
jsonRead
in interfaceScalarType<UUID>
- Throws:
IOException
-
getDocType
public DocPropertyType getDocType()
Description copied from interface:ScalarType
Return the type this maps to for JSON document stores.- Specified by:
getDocType
in interfaceScalarType<UUID>
-
-