Package org.hibernate.usertype.internal
Class AbstractTimeZoneStorageCompositeUserType<T>
- java.lang.Object
-
- org.hibernate.usertype.internal.AbstractTimeZoneStorageCompositeUserType<T>
-
- All Implemented Interfaces:
EmbeddableInstantiator
,Instantiator
,CompositeUserType<T>
- Direct Known Subclasses:
OffsetDateTimeCompositeUserType
,OffsetTimeCompositeUserType
,ZonedDateTimeCompositeUserType
public abstract class AbstractTimeZoneStorageCompositeUserType<T> extends Object implements CompositeUserType<T>
-
-
Field Summary
Fields Modifier and Type Field Description static String
INSTANT_NAME
static String
ZONE_OFFSET_NAME
-
Constructor Summary
Constructors Constructor Description AbstractTimeZoneStorageCompositeUserType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
assemble(Serializable cached, Object owner)
Reconstruct an object from the cacheable representation.T
deepCopy(T value)
Return a deep copy of the persistent state, stopping at entities and at collections.Serializable
disassemble(T value)
Transform the object into its cacheable representation.boolean
equals(T x, T y)
Compare two instances of the class mapped by this type for persistence "equality".int
hashCode(T x)
Get a hashcode for the instance, consistent with persistence "equality"boolean
isMutable()
Are objects of this type mutable?T
replace(T detached, T managed, Object owner)
During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.usertype.CompositeUserType
embeddable, getPropertyValue, instantiate, isInstance, isSameClass, returnedClass
-
-
-
-
Field Detail
-
INSTANT_NAME
public static final String INSTANT_NAME
- See Also:
- Constant Field Values
-
ZONE_OFFSET_NAME
public static final String ZONE_OFFSET_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
equals
public boolean equals(T x, T y)
Description copied from interface:CompositeUserType
Compare two instances of the class mapped by this type for persistence "equality". Equality of the persistent state.- Specified by:
equals
in interfaceCompositeUserType<T>
-
hashCode
public int hashCode(T x)
Description copied from interface:CompositeUserType
Get a hashcode for the instance, consistent with persistence "equality"- Specified by:
hashCode
in interfaceCompositeUserType<T>
-
deepCopy
public T deepCopy(T value)
Description copied from interface:CompositeUserType
Return a deep copy of the persistent state, stopping at entities and at collections. It is not necessary to copy immutable objects, or null values, in which case it is safe to simply return the argument.- Specified by:
deepCopy
in interfaceCompositeUserType<T>
- Parameters:
value
- the object to be cloned, which may be null- Returns:
- Object a copy
-
isMutable
public boolean isMutable()
Description copied from interface:CompositeUserType
Are objects of this type mutable?- Specified by:
isMutable
in interfaceCompositeUserType<T>
- Returns:
- boolean
-
disassemble
public Serializable disassemble(T value)
Description copied from interface:CompositeUserType
Transform the object into its cacheable representation. At the very least this method should perform a deep copy if the type is mutable. That may not be enough for some implementations, however; for example, associations must be cached as identifier values. (optional operation)- Specified by:
disassemble
in interfaceCompositeUserType<T>
- Parameters:
value
- the object to be cached- Returns:
- a cacheable representation of the object
-
assemble
public T assemble(Serializable cached, Object owner)
Description copied from interface:CompositeUserType
Reconstruct an object from the cacheable representation. At the very least this method should perform a deep copy if the type is mutable. (optional operation)- Specified by:
assemble
in interfaceCompositeUserType<T>
- Parameters:
cached
- the object to be cachedowner
- the owner of the cached object- Returns:
- a reconstructed object from the cacheable representation
-
replace
public T replace(T detached, T managed, Object owner)
Description copied from interface:CompositeUserType
During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging. For immutable objects, or null values, it is safe to simply return the first parameter. For mutable objects, it is safe to return a copy of the first parameter. For objects with component values, it might make sense to recursively replace component values.- Specified by:
replace
in interfaceCompositeUserType<T>
- Parameters:
detached
- the value from the detached entity being mergedmanaged
- the value in the managed entity- Returns:
- the value to be merged
-
-