Class Entity

java.lang.Object
my.edu.tarc.dco.bookrentalpos.Entity
Direct Known Subclasses:
Book, Member, Staff, Transaction

public class Entity
extends Object
Parent class of all entity in POS system
Version:
1.0
Author:
Looz
  • Constructor Details

    • Entity

      public Entity()
      Blank
    • Entity

      public Entity​(int id, String name, String dateCreated)
      Constructor to initialise Entity
      Parameters:
      id - - can be 0 if you wish not to initialise it
      name - - can be null if u wish not to intialise
      dateCreated - - can be null if u wish not to intialise
  • Method Details

    • equals

      public boolean equals​(Object obj)
      Overridden equals() method to check against id of the entity
      Overrides:
      equals in class Object
      Parameters:
      obj - Can be integer indicating id
      Returns:
      true if the id matches
    • getId

      public final int getId()
      Returns:
      ID of the entity, usually generated by database
    • getName

      public final String getName()
      Returns:
      name of the entity
    • getDateCreated

      public final String getDateCreated()
      Returns:
      date the entity was created in database, usually generated by database
    • setID

      public final void setID​(int id)
      This function shouldn't be used except for initialization purpose
      Parameters:
      id - id of the entity
    • setName

      public final void setName​(String name)
      Parameters:
      name - name of the entity
    • setDateCreated

      public final void setDateCreated​(String date)
      This function shouldn't be used except for initialization purpose
      Parameters:
      date - creation date of the entity in database