Class CustomerEntity

java.lang.Object
org.example.customer.utility.CustomerEntity
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Customer, Order, OrderItem, Product, Supplier

public class CustomerEntity extends Object implements Serializable
The Customer Entity for the Customer application.

This class represents the common Id field in the Customer Database
Version:
1.0
Author:
Jonathan Earl
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    The default constructor for the CustomerEntity class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    The equals() method of the CustomerEntity class.
    int
    Returns the id value for the Customer.
    int
    The hashCode() method of the CustomerEntity class.
    void
    setId(int id)
    Sets the id value for the Customer.
    The toString method for the CustomerEntity class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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
      Overrides:
      hashCode in class Object
      Returns:
      the hashCode value for this CustomerEntity object
      See Also:
    • equals

      public boolean equals(Object obj)
      The equals() method of the CustomerEntity class.

      This method uses:

      • id
      Overrides:
      equals in class Object
      Parameters:
      obj - the incoming object to compare against
      Returns:
      true if the fields being compared are equal
      See Also:
    • toString

      public String toString()
      The toString method for the CustomerEntity class. this method will return:
      CustomerEntity [Id=xxx]
      Overrides:
      toString in class Object