Class MutableBasicUserType<X>
java.lang.Object
com.blazebit.persistence.view.spi.type.AbstractMutableBasicUserType<X>
com.blazebit.persistence.view.spi.type.MutableBasicUserType<X>
- Type Parameters:
X
- The type of the user type
- All Implemented Interfaces:
BasicUserType<X>
,BasicUserTypeStringSupport<X>
public class MutableBasicUserType<X> extends AbstractMutableBasicUserType<X>
The default basic user type implementation for unknown types.
- Since:
- 1.2.0
- Author:
- Christian Beikov
-
Field Summary
Fields Modifier and Type Field Description static BasicUserType<?>
INSTANCE
-
Constructor Summary
Constructors Constructor Description MutableBasicUserType()
-
Method Summary
Modifier and Type Method Description X
deepClone(X object)
Clones the given object if the type is mutable to be able to detect mutations.X
fromString(CharSequence sequence)
Creates an instance of the type from the given string representation.int
hashCode(X object)
Returns the hash code of the object for lookups in hash based collections.boolean
isDeepEqual(X initial, X current)
Returnstrue
if the given objects are equal regarding their values.boolean
isEqual(X initial, X current)
Returnstrue
if the given objects are equal regarding their identity.boolean
supportsDeepCloning()
Returnstrue
if the type supports creating deep clones,false
otherwise.boolean
supportsDeepEqualChecking()
Returnstrue
if the type supports checking deep equality,false
otherwise.String
toStringExpression(String expression)
Wraps the given JPQL.Next expression such that it is converted to the internal string representation that can be read byBasicUserTypeStringSupport.fromString(CharSequence)
.Methods inherited from class com.blazebit.persistence.view.spi.type.AbstractMutableBasicUserType
getDirtyProperties, isMutable, shouldPersist, supportsDirtyChecking, supportsDirtyTracking
-
Field Details
-
Constructor Details
-
MutableBasicUserType
public MutableBasicUserType()
-
-
Method Details
-
supportsDeepEqualChecking
public boolean supportsDeepEqualChecking()Description copied from interface:BasicUserType
Returnstrue
if the type supports checking deep equality,false
otherwise. Deep equality checking, in contrast to normal equality checking, compares objects by their actual values rather than maybe just their identity. For value types, deep equality checking is the same as normal equality checking.- Specified by:
supportsDeepEqualChecking
in interfaceBasicUserType<X>
- Overrides:
supportsDeepEqualChecking
in classAbstractMutableBasicUserType<X>
- Returns:
- true if deep equality checking is supported, false otherwise
-
supportsDeepCloning
public boolean supportsDeepCloning()Description copied from interface:BasicUserType
Returnstrue
if the type supports creating deep clones,false
otherwise. Deep clones are only necessary for mutable types that don't support dirty checking. Immutable types can simply returntrue
.- Specified by:
supportsDeepCloning
in interfaceBasicUserType<X>
- Overrides:
supportsDeepCloning
in classAbstractMutableBasicUserType<X>
- Returns:
- true if deep cloning is supported, false otherwise
-
isEqual
Description copied from interface:BasicUserType
Returnstrue
if the given objects are equal regarding their identity. For value types, this is the same as deep equality checking.- Specified by:
isEqual
in interfaceBasicUserType<X>
- Overrides:
isEqual
in classAbstractMutableBasicUserType<X>
- Parameters:
initial
- The first objectcurrent
- The second object- Returns:
- true if the objects are equal, false otherwise
-
isDeepEqual
Description copied from interface:BasicUserType
Returnstrue
if the given objects are equal regarding their values. If deep equality is not supported, returns false.- Specified by:
isDeepEqual
in interfaceBasicUserType<X>
- Overrides:
isDeepEqual
in classAbstractMutableBasicUserType<X>
- Parameters:
initial
- The first objectcurrent
- The second object- Returns:
- true if the objects are equal, false otherwise
-
hashCode
Description copied from interface:BasicUserType
Returns the hash code of the object for lookups in hash based collections.- Specified by:
hashCode
in interfaceBasicUserType<X>
- Overrides:
hashCode
in classAbstractMutableBasicUserType<X>
- Parameters:
object
- The object- Returns:
- the hash code of the object
-
deepClone
Description copied from interface:BasicUserType
Clones the given object if the type is mutable to be able to detect mutations. Immutable types may return the object itself. Types that can't be cloned easily can return the object too, but should make sure, that the deep equality check always returnsfalse
or dirty checking is properly supported.- Parameters:
object
- The object to clone- Returns:
- The cloned object
-
fromString
Description copied from interface:BasicUserTypeStringSupport
Creates an instance of the type from the given string representation.- Specified by:
fromString
in interfaceBasicUserTypeStringSupport<X>
- Overrides:
fromString
in classAbstractMutableBasicUserType<X>
- Parameters:
sequence
- A string representation of the object- Returns:
- The object
-
toStringExpression
Description copied from interface:BasicUserTypeStringSupport
Wraps the given JPQL.Next expression such that it is converted to the internal string representation that can be read byBasicUserTypeStringSupport.fromString(CharSequence)
.- Specified by:
toStringExpression
in interfaceBasicUserTypeStringSupport<X>
- Overrides:
toStringExpression
in classAbstractMutableBasicUserType<X>
- Parameters:
expression
- The JPQL.Next expression string- Returns:
- The object
-