Class Client
java.lang.Object
io.github.marcopaglio.booking.model.BaseEntity
io.github.marcopaglio.booking.model.Client
This entity represents the customer's model of the booking application.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Table name used in a database to accessClient
entities.static final String
Field name used in a database to access thefirstName
attribute.static final String
Field name used in a database to access thelastName
attribute.Fields inherited from class io.github.marcopaglio.booking.model.BaseEntity
ID_MONGODB, ID_POSTGRESQL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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
hashCode()
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.toString()
Overridden method for returning a string representation of the client.Methods inherited from class io.github.marcopaglio.booking.model.BaseEntity
getId, setId
-
Field Details
-
CLIENT_TABLE_DB
Table name used in a database to accessClient
entities.- See Also:
-
FIRSTNAME_DB
Field name used in a database to access thefirstName
attribute.- See Also:
-
LASTNAME_DB
Field name used in a database to access thelastName
attribute.- See Also:
-
-
Constructor Details
-
Client
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
Retrieves the name of the client. Note: Java String Objects are immutable.- Returns:
- the
firstName
of the client.
-
setFirstName
Sets the name of the client.- Parameters:
firstName
- the name to set.
-
getLastName
Retrieves the surname of the client. Note: Java String Objects are immutable.- Returns:
- the
lastName
of the client.
-
setLastName
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 classBaseEntity
- Returns:
- a hash code value for this client object.
-
equals
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 classBaseEntity
- Parameters:
obj
- the reference client object with which to compare.- Returns:
true
if this object is the same as theobj
argument;false
otherwise.
-
toString
Overridden method for returning a string representation of the client.- Specified by:
toString
in classBaseEntity
- Returns:
- a string representation of the client.
-