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 Details

  • Constructor Details

    • MutableBasicUserType

      public MutableBasicUserType()
  • Method Details

    • supportsDeepEqualChecking

      public boolean supportsDeepEqualChecking()
      Description copied from interface: BasicUserType
      Returns true 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 interface BasicUserType<X>
      Overrides:
      supportsDeepEqualChecking in class AbstractMutableBasicUserType<X>
      Returns:
      true if deep equality checking is supported, false otherwise
    • supportsDeepCloning

      public boolean supportsDeepCloning()
      Description copied from interface: BasicUserType
      Returns true 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 return true.
      Specified by:
      supportsDeepCloning in interface BasicUserType<X>
      Overrides:
      supportsDeepCloning in class AbstractMutableBasicUserType<X>
      Returns:
      true if deep cloning is supported, false otherwise
    • isEqual

      public boolean isEqual(X initial, X current)
      Description copied from interface: BasicUserType
      Returns true if the given objects are equal regarding their identity. For value types, this is the same as deep equality checking.
      Specified by:
      isEqual in interface BasicUserType<X>
      Overrides:
      isEqual in class AbstractMutableBasicUserType<X>
      Parameters:
      initial - The first object
      current - The second object
      Returns:
      true if the objects are equal, false otherwise
    • isDeepEqual

      public boolean isDeepEqual(X initial, X current)
      Description copied from interface: BasicUserType
      Returns true if the given objects are equal regarding their values. If deep equality is not supported, returns false.
      Specified by:
      isDeepEqual in interface BasicUserType<X>
      Overrides:
      isDeepEqual in class AbstractMutableBasicUserType<X>
      Parameters:
      initial - The first object
      current - The second object
      Returns:
      true if the objects are equal, false otherwise
    • hashCode

      public int hashCode(X object)
      Description copied from interface: BasicUserType
      Returns the hash code of the object for lookups in hash based collections.
      Specified by:
      hashCode in interface BasicUserType<X>
      Overrides:
      hashCode in class AbstractMutableBasicUserType<X>
      Parameters:
      object - The object
      Returns:
      the hash code of the object
    • deepClone

      public X deepClone(X object)
      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 returns false or dirty checking is properly supported.
      Parameters:
      object - The object to clone
      Returns:
      The cloned object
    • fromString

      public X fromString(CharSequence sequence)
      Description copied from interface: BasicUserTypeStringSupport
      Creates an instance of the type from the given string representation.
      Specified by:
      fromString in interface BasicUserTypeStringSupport<X>
      Overrides:
      fromString in class AbstractMutableBasicUserType<X>
      Parameters:
      sequence - A string representation of the object
      Returns:
      The object
    • toStringExpression

      public String toStringExpression(String expression)
      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 by BasicUserTypeStringSupport.fromString(CharSequence).
      Specified by:
      toStringExpression in interface BasicUserTypeStringSupport<X>
      Overrides:
      toStringExpression in class AbstractMutableBasicUserType<X>
      Parameters:
      expression - The JPQL.Next expression string
      Returns:
      The object