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 defaultMutabilityPlanfor 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
enums 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
MutabilityPlanusing@Mutability, or - explicitly specify its
JavaTypeDescriptorusing@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 Tassemble(Serializable cached, SharedSessionContract session)Assemble a previously disassembled value.protected TdeepCopyNotNull(T value)Serializabledisassemble(T value, SharedSessionContract session)Return a disassembled representation of the value.booleanisMutable()Can the internal state of instances ofTbe 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:MutabilityPlanCan the internal state of instances ofTbe changed?- Specified by:
isMutablein interfaceMutabilityPlan<T>- Overrides:
isMutablein classMutableMutabilityPlan<T>- Returns:
- True if the internal state can be changed; false otherwise.
-
deepCopyNotNull
protected T deepCopyNotNull(T value)
- Specified by:
deepCopyNotNullin classMutableMutabilityPlan<T>
-
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>- Overrides:
disassemblein classMutableMutabilityPlan<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>- Overrides:
assemblein classMutableMutabilityPlan<T>- See Also:
MutabilityPlan.disassemble(T, org.hibernate.SharedSessionContract)
-
-