Package org.example.customer.utility
Class CustomerEntity
java.lang.Object
org.example.customer.utility.CustomerEntity
- All Implemented Interfaces:
Serializable
The Customer Entity for the Customer application.
This class represents the common Id field in the Customer Database
This class represents the common Id field in the Customer Database
- Version:
- 1.0
- Author:
- Jonathan Earl
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThe equals() method of the CustomerEntity class.intgetId()Returns the id value for the Customer.inthashCode()The hashCode() method of the CustomerEntity class.voidsetId(int id) Sets the id value for the Customer.toString()The toString method for the CustomerEntity class.
-
Constructor Details
-
CustomerEntity
public CustomerEntity()The default constructor for the CustomerEntity class.The initial values are:
- id: 1
-
-
Method Details
-
getId
public int getId()Returns the id value for the Customer.- Returns:
- the id value for the customer
-
setId
public void setId(int id) Sets the id value for the Customer.The business rules are:
- the id must be 1 or greater
- Parameters:
id- the value to set into the customer id field- Throws:
IllegalArgumentException- if the id is invalid
-
hashCode
public int hashCode()The hashCode() method of the CustomerEntity class.This method uses:
- id
-
equals
The equals() method of the CustomerEntity class.This method uses:
- id
-
toString
The toString method for the CustomerEntity class. this method will return:
CustomerEntity [Id=xxx]
-