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 Tassemble(Serializable cached, SharedSessionContract session)Assemble a previously disassembled value.TdeepCopy(T value)Return a deep copy of the value.Serializabledisassemble(T value, SharedSessionContract session)Return a disassembled representation of the value.TfromString(CharSequence string)protected abstract FormatMappergetFormatMapper(TypeConfiguration typeConfiguration)MutabilityPlan<T>getMutabilityPlan()Retrieve the mutability plan for this Java type.JdbcTypegetRecommendedJdbcType(JdbcTypeIndicators context)Obtain the "recommended"SQL type descriptorfor this Java type.booleanisMutable()Can the internal state of instances ofTbe changed?StringtoString(T value)<X> Xunwrap(T value, Class<X> type, WrapperOptions options)Unwrap an instance of our handled Java type into the requested type.<X> Twrap(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, getCheckCondition, getDefaultSqlLength, getDefaultSqlPrecision, getDefaultSqlScale, getDefaultValue, getJavaTypeClass, getLongSqlLength, getReplacement, getTypeName, isInstance, isTemporalType, isWider, useObjectEqualsHashCode
-
-
-
-
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:BasicJavaTypeObtain the "recommended"SQL type descriptorfor this Java type. Often, but not always, the source of this recommendation is the JDBC specification.- Specified by:
getRecommendedJdbcTypein interfaceBasicJavaType<T>- Specified by:
getRecommendedJdbcTypein interfaceJavaType<T>- Parameters:
context- Contextual information- Returns:
- The recommended SQL type descriptor
-
fromString
public T fromString(CharSequence string)
- Specified by:
fromStringin interfaceBasicJavaType<T>- Specified by:
fromStringin interfaceJavaType<T>
-
unwrap
public <X> X unwrap(T value, Class<X> type, WrapperOptions options)
Description copied from interface:JavaTypeUnwrap 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 valueas aLong, we would return something likeLong.valueOf( value.longValue() ).Intended use is during
PreparedStatementbinding.
-
wrap
public <X> T wrap(X value, WrapperOptions options)
Description copied from interface:JavaTypeWrap a value as our handled Java type.Intended use is during
ResultSetextraction.
-
getMutabilityPlan
public MutabilityPlan<T> getMutabilityPlan()
Description copied from interface:JavaTypeRetrieve the mutability plan for this Java type.- Specified by:
getMutabilityPlanin interfaceJavaType<T>- Overrides:
getMutabilityPlanin classAbstractJavaType<T>
-
isMutable
public boolean isMutable()
Description copied from interface:MutabilityPlanCan the internal state of instances ofTbe changed?- Specified by:
isMutablein interfaceMutabilityPlan<T>- Returns:
- True if the internal state can be changed; false otherwise.
-
deepCopy
public T deepCopy(T value)
Description copied from interface:MutabilityPlanReturn a deep copy of the value.- Specified by:
deepCopyin 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:MutabilityPlanReturn 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:
disassemblein interfaceMutabilityPlan<T>- See Also:
MutabilityPlan.assemble(java.io.Serializable, org.hibernate.SharedSessionContract)
-
assemble
public T assemble(Serializable cached, SharedSessionContract session)
Description copied from interface:MutabilityPlanAssemble a previously disassembled value.Called after reading a value from the second level cache.
Complementary to
MutabilityPlan.disassemble(T, org.hibernate.SharedSessionContract).- Specified by:
assemblein interfaceMutabilityPlan<T>- See Also:
MutabilityPlan.disassemble(T, org.hibernate.SharedSessionContract)
-
-