Class AbstractUniqueEntity<ID extends java.io.Serializable>

    • Constructor Detail

      • AbstractUniqueEntity

        protected AbstractUniqueEntity()
        The default constructor.
      • AbstractUniqueEntity

        protected AbstractUniqueEntity​(ID id)
        Constructs an object with the given id.
        Parameters:
        id - the ID of the object to construct
      • AbstractUniqueEntity

        protected AbstractUniqueEntity​(UniqueObject<ID> that)
        Constructs a copy of the given object.
        Parameters:
        that - the object to copy
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • equalsWithNullCheck

        public boolean equalsWithNullCheck​(java.lang.Object value1,
                                           java.lang.Object value2)
        Parameters:
        value1 -
        value2 -
        Returns:
      • getId

        public ID getId()
        Returns the ID of the object. Subclasses need to specify the Column annotation. The ID annotation is necessary: "You cannot override the [id] non-identifier property from the [...AbstractUniqueObject] base class or MappedSuperclass and make it an identifier in the subclass!" So we should not need it in the subclasses.
        Specified by:
        getId in interface UniqueObject<ID extends java.io.Serializable>
        Returns:
        the unique id of the object.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • setId

        public void setId​(ID id)
        Specified by:
        setId in interface UniqueObject<ID extends java.io.Serializable>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object