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
FieldsModifier and TypeFieldDescriptionstatic final StringTable name used in a database to accessCliententities.static final StringField name used in a database to access thefirstNameattribute.static final StringField name used in a database to access thelastNameattribute.Fields inherited from class io.github.marcopaglio.booking.model.BaseEntity
ID_MONGODB, ID_POSTGRESQL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanOverridden 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.inthashCode()Overridden method for returning a hash code value for the client object.voidsetFirstName(String firstName) Sets the name of the client.voidsetLastName(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 accessCliententities.- See Also:
-
FIRSTNAME_DB
Field name used in a database to access thefirstNameattribute.- See Also:
-
LASTNAME_DB
Field name used in a database to access thelastNameattribute.- 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
firstNameof 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
lastNameof 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:
hashCodein 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:
equalsin classBaseEntity- Parameters:
obj- the reference client object with which to compare.- Returns:
trueif this object is the same as theobjargument;falseotherwise.
-
toString
Overridden method for returning a string representation of the client.- Specified by:
toStringin classBaseEntity- Returns:
- a string representation of the client.
-