Class Client

java.lang.Object
io.github.marcopaglio.booking.model.BaseEntity
io.github.marcopaglio.booking.model.Client

@Entity public class Client extends BaseEntity
This entity represents the customer's model of the booking application.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Table name used in a database to access Client entities.
    static final String
    Field name used in a database to access the firstName attribute.
    static final String
    Field name used in a database to access the lastName attribute.

    Fields inherited from class io.github.marcopaglio.booking.model.BaseEntity

    ID_MONGODB, ID_POSTGRESQL
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Empty constructor needed for database purposes.
     
    Client(String firstName, String lastName)
    Constructs a client for the booking application with a name, a surname and an identifier.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Overridden method for indicating whether some other client object is "equal to" this one.
    Retrieves the name of the client.
    Retrieves the surname of the client.
    int
    Overridden method for returning a hash code value for the client object.
    void
    setFirstName(String firstName)
    Sets the name of the client.
    void
    setLastName(String lastName)
    Sets the surname of the client.
    Overridden method for returning a string representation of the client.

    Methods inherited from class io.github.marcopaglio.booking.model.BaseEntity

    getId, setId

    Methods inherited from class java.lang.Object

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

    • CLIENT_TABLE_DB

      public static final String CLIENT_TABLE_DB
      Table name used in a database to access Client entities.
      See Also:
    • FIRSTNAME_DB

      public static final String FIRSTNAME_DB
      Field name used in a database to access the firstName attribute.
      See Also:
    • LASTNAME_DB

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

    • Client

      public Client(String firstName, String lastName)
      Constructs a client for the booking application with a name, a surname and an identifier.
      Parameters:
      firstName - the name of the client.
      lastName - the surname of the client.
    • Client

      protected Client()
      Empty constructor needed for database purposes.
  • Method Details

    • getFirstName

      public String getFirstName()
      Retrieves the name of the client. Note: Java String Objects are immutable.
      Returns:
      the firstName of the client.
    • setFirstName

      public void setFirstName(String firstName)
      Sets the name of the client.
      Parameters:
      firstName - the name to set.
    • getLastName

      public String getLastName()
      Retrieves the surname of the client. Note: Java String Objects are immutable.
      Returns:
      the lastName of the client.
    • setLastName

      public void setLastName(String lastName)
      Sets the surname of the client.
      Parameters:
      lastName - the surname to set.
    • hashCode

      public int hashCode()
      Overridden method for returning a hash code value for the client object.
      Specified by:
      hashCode in class BaseEntity
      Returns:
      a hash code value for this client object.
    • equals

      public boolean equals(Object obj)
      Overridden method for indicating whether some other client object is "equal to" this one. Two client objects are equal if they have both the same name and surname.
      Specified by:
      equals in class BaseEntity
      Parameters:
      obj - the reference client object with which to compare.
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • toString

      public String toString()
      Overridden method for returning a string representation of the client.
      Specified by:
      toString in class BaseEntity
      Returns:
      a string representation of the client.