Class BaseEntity

java.lang.Object
io.github.marcopaglio.booking.model.BaseEntity
Direct Known Subclasses:
Client, Reservation

@MappedSuperclass public abstract class BaseEntity extends Object
Contains the necessary structure of a generic entity.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Field name used in a MongoDB database to access the id attribute.
    static final String
    Field name used in a PostgreSQL database to access the id attribute.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Empty constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    Enforces overriding in entity classes based on equality.
    Retrieves the identifier of the entity.
    abstract int
    Enforces overriding in entity classes based on equality.
    void
    setId(UUID id)
    Sets the identifier of the entity.
    abstract String
    Enforces overriding in entity classes based on descriptiveness.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ID_MONGODB

      public static final String ID_MONGODB
      Field name used in a MongoDB database to access the id attribute.
      See Also:
    • ID_POSTGRESQL

      public static final String ID_POSTGRESQL
      Field name used in a PostgreSQL database to access the id attribute.
      See Also:
  • Constructor Details

    • BaseEntity

      protected BaseEntity()
      Empty constructor.
  • Method Details

    • getId

      public UUID getId()
      Retrieves the identifier of the entity. Note: UUID Objects are immutable.
      Returns:
      the UUID of the entity.
    • setId

      public void setId(UUID id)
      Sets the identifier of the entity.
      Parameters:
      id - the identifier to set.
    • hashCode

      public abstract int hashCode()
      Enforces overriding in entity classes based on equality.
      Overrides:
      hashCode in class Object
    • equals

      public abstract boolean equals(Object obj)
      Enforces overriding in entity classes based on equality.
      Overrides:
      equals in class Object
    • toString

      public abstract String toString()
      Enforces overriding in entity classes based on descriptiveness.
      Overrides:
      toString in class Object