Class FormatMapperBasedJavaType<T>
- java.lang.Object
-
- org.hibernate.type.descriptor.java.AbstractJavaType<T>
-
- org.hibernate.type.descriptor.java.spi.FormatMapperBasedJavaType<T>
-
- All Implemented Interfaces:
Serializable
,BasicJavaType<T>
,JavaType<T>
,MutabilityPlan<T>
- Direct Known Subclasses:
JsonJavaType
,XmlJavaType
@Incubating public abstract class FormatMapperBasedJavaType<T> extends AbstractJavaType<T> implements MutabilityPlan<T>
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.type.descriptor.java.JavaType
JavaType.CoercionContext
-
-
Constructor Summary
Constructors Constructor Description FormatMapperBasedJavaType(Type type, MutabilityPlan<T> mutabilityPlan, TypeConfiguration typeConfiguration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
assemble(Serializable cached, SharedSessionContract session)
Assemble a previously disassembled value.T
deepCopy(T value)
Return a deep copy of the value.Serializable
disassemble(T value, SharedSessionContract session)
Return a disassembled representation of the value.T
fromString(CharSequence string)
protected abstract FormatMapper
getFormatMapper(TypeConfiguration typeConfiguration)
MutabilityPlan<T>
getMutabilityPlan()
Retrieve the mutability plan for this Java type.JdbcType
getRecommendedJdbcType(JdbcTypeIndicators context)
Obtain the "recommended"SQL type descriptor
for this Java type.boolean
isMutable()
Can the internal state of instances ofT
be changed?String
toString(T value)
<X> X
unwrap(T value, Class<X> type, WrapperOptions options)
Unwrap an instance of our handled Java type into the requested type.<X> T
wrap(X value, WrapperOptions options)
Wrap a value as our handled Java type.-
Methods inherited from class org.hibernate.type.descriptor.java.AbstractJavaType
areEqual, extractHashCode, extractLoggableRepresentation, getComparator, getJavaType, unknownUnwrap, unknownWrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.type.descriptor.java.JavaType
appendEncodedString, coerce, createJavaType, createJavaType, fromEncodedString, getDefaultSqlLength, getDefaultSqlPrecision, getDefaultSqlScale, getDefaultValue, getJavaTypeClass, getLongSqlLength, getReplacement, isInstance, isTemporalType, isWider
-
-
-
-
Constructor Detail
-
FormatMapperBasedJavaType
public FormatMapperBasedJavaType(Type type, MutabilityPlan<T> mutabilityPlan, TypeConfiguration typeConfiguration)
-
-
Method Detail
-
getFormatMapper
protected abstract FormatMapper getFormatMapper(TypeConfiguration typeConfiguration)
-
getRecommendedJdbcType
public JdbcType getRecommendedJdbcType(JdbcTypeIndicators context)
Description copied from interface:BasicJavaType
Obtain the "recommended"SQL type descriptor
for this Java type. Often, but not always, the source of this recommendation is the JDBC specification.- Specified by:
getRecommendedJdbcType
in interfaceBasicJavaType<T>
- Specified by:
getRecommendedJdbcType
in interfaceJavaType<T>
- Parameters:
context
- Contextual information- Returns:
- The recommended SQL type descriptor
-
fromString
public T fromString(CharSequence string)
- Specified by:
fromString
in interfaceBasicJavaType<T>
- Specified by:
fromString
in interfaceJavaType<T>
-
unwrap
public <X> X unwrap(T value, Class<X> type, WrapperOptions options)
Description copied from interface:JavaType
Unwrap an instance of our handled Java type into the requested type.As an example, if this is a
JavaType<Integer>
and we are asked to unwrap theInteger value
as aLong
, we would return something likeLong.valueOf( value.longValue() )
.Intended use is during
PreparedStatement
binding.
-
wrap
public <X> T wrap(X value, WrapperOptions options)
Description copied from interface:JavaType
Wrap a value as our handled Java type.Intended use is during
ResultSet
extraction.
-
getMutabilityPlan
public MutabilityPlan<T> getMutabilityPlan()
Description copied from interface:JavaType
Retrieve the mutability plan for this Java type.- Specified by:
getMutabilityPlan
in interfaceJavaType<T>
- Overrides:
getMutabilityPlan
in classAbstractJavaType<T>
-
isMutable
public boolean isMutable()
Description copied from interface:MutabilityPlan
Can the internal state of instances ofT
be changed?- Specified by:
isMutable
in interfaceMutabilityPlan<T>
- Returns:
- True if the internal state can be changed; false otherwise.
-
deepCopy
public T deepCopy(T value)
Description copied from interface:MutabilityPlan
Return a deep copy of the value.- Specified by:
deepCopy
in interfaceMutabilityPlan<T>
- Parameters:
value
- The value to deep copy- Returns:
- The deep copy.
-
disassemble
public Serializable disassemble(T value, SharedSessionContract session)
Description copied from interface:MutabilityPlan
Return a disassembled representation of the value.Called before storing a value in the second-level cache.
Complementary to
MutabilityPlan.assemble(java.io.Serializable, org.hibernate.SharedSessionContract)
.- Specified by:
disassemble
in interfaceMutabilityPlan<T>
- See Also:
MutabilityPlan.assemble(java.io.Serializable, org.hibernate.SharedSessionContract)
-
assemble
public T assemble(Serializable cached, SharedSessionContract session)
Description copied from interface:MutabilityPlan
Assemble a previously disassembled value.Called after reading a value from the second level cache.
Complementary to
MutabilityPlan.disassemble(T, org.hibernate.SharedSessionContract)
.- Specified by:
assemble
in interfaceMutabilityPlan<T>
- See Also:
MutabilityPlan.disassemble(T, org.hibernate.SharedSessionContract)
-
-