Class AttributeConverterMutabilityPlanImpl<T>
- java.lang.Object
-
- org.hibernate.type.descriptor.java.MutableMutabilityPlan<T>
-
- org.hibernate.type.descriptor.converter.internal.AttributeConverterMutabilityPlanImpl<T>
-
- All Implemented Interfaces:
Serializable
,MutabilityPlan<T>
public class AttributeConverterMutabilityPlanImpl<T> extends MutableMutabilityPlan<T>
The defaultMutabilityPlan
for a converted value assumes, in the absence of additional evidence, that the value is mutable, so that dirty checking, deep copying, and second-level caching all work correctly in the case where it really is mutable.As an exception to this, Java primitive types and
enum
s are inferred to be immutable.To explicitly mark a converted value is immutable and avoid the extra processing required for a mutable value, either:
- mark the Java type of the attribute, the type passed to the converter, as
@Immutable
, - explicitly specify a
MutabilityPlan
using@Mutability
, or - explicitly specify its
JavaTypeDescriptor
using@JavaType
.
-
-
Field Summary
-
Fields inherited from class org.hibernate.type.descriptor.java.MutableMutabilityPlan
INSTANCE
-
-
Constructor Summary
Constructors Constructor Description AttributeConverterMutabilityPlanImpl(JpaAttributeConverter converter, boolean mutable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
assemble(Serializable cached, SharedSessionContract session)
Assemble a previously disassembled value.protected T
deepCopyNotNull(T value)
Serializable
disassemble(T value, SharedSessionContract session)
Return a disassembled representation of the value.boolean
isMutable()
Can the internal state of instances ofT
be changed?-
Methods inherited from class org.hibernate.type.descriptor.java.MutableMutabilityPlan
deepCopy
-
-
-
-
Constructor Detail
-
AttributeConverterMutabilityPlanImpl
public AttributeConverterMutabilityPlanImpl(JpaAttributeConverter converter, boolean mutable)
-
-
Method Detail
-
isMutable
public boolean isMutable()
Description copied from interface:MutabilityPlan
Can the internal state of instances ofT
be changed?- Specified by:
isMutable
in interfaceMutabilityPlan<T>
- Overrides:
isMutable
in classMutableMutabilityPlan<T>
- Returns:
- True if the internal state can be changed; false otherwise.
-
deepCopyNotNull
protected T deepCopyNotNull(T value)
- Specified by:
deepCopyNotNull
in classMutableMutabilityPlan<T>
-
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>
- Overrides:
disassemble
in classMutableMutabilityPlan<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>
- Overrides:
assemble
in classMutableMutabilityPlan<T>
- See Also:
MutabilityPlan.disassemble(T, org.hibernate.SharedSessionContract)
-
-