Package records

Record Class LeaveBalanceRecord

java.lang.Object
java.lang.Record
records.LeaveBalanceRecord

public record LeaveBalanceRecord(int employeeID, int sickBalance, int vacationBalance, int paternalBalance, int bereavementBalance) extends Record
Represents a leave balance record. This record contains information about an employee's leave balances, including sick balance, vacation balance, paternal balance, and bereavement balance.

Available methods:

  • Constructor Details

    • LeaveBalanceRecord

      public LeaveBalanceRecord(int employeeID, int sickBalance, int vacationBalance, int paternalBalance, int bereavementBalance)
      Creates an instance of a LeaveBalanceRecord record class.
      Parameters:
      employeeID - the value for the employeeID record component
      sickBalance - the value for the sickBalance record component
      vacationBalance - the value for the vacationBalance record component
      paternalBalance - the value for the paternalBalance record component
      bereavementBalance - the value for the bereavementBalance record component
  • Method Details

    • withSickBalance

      public LeaveBalanceRecord withSickBalance(int sickBalance)
      Returns a new LeaveBalanceRecord with the specified sick balance.
      Parameters:
      sickBalance - the sick balance
      Returns:
      a new LeaveBalanceRecord with the specified sick balance
    • withVacationBalance

      public LeaveBalanceRecord withVacationBalance(int vacationBalance)
      Returns a new LeaveBalanceRecord with the specified vacation balance.
      Parameters:
      vacationBalance - the vacation balance
      Returns:
      a new LeaveBalanceRecord with the specified vacation balance
    • withPaternalBalance

      public LeaveBalanceRecord withPaternalBalance(int paternalBalance)
      Returns a new LeaveBalanceRecord with the specified paternal balance.
      Parameters:
      paternalBalance - the paternal balance
      Returns:
      a new LeaveBalanceRecord with the specified paternal balance
    • withBereavementBalance

      public LeaveBalanceRecord withBereavementBalance(int bereavementBalance)
      Returns a new LeaveBalanceRecord with the specified bereavement balance.
      Parameters:
      bereavementBalance - the bereavement balance
      Returns:
      a new LeaveBalanceRecord with the specified bereavement balance
    • toArray

      public String[] toArray()
      Converts the LeaveBalanceRecord to an array of strings.
      Returns:
      an array of strings representing the LeaveBalanceRecord
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • employeeID

      public int employeeID()
      Returns the value of the employeeID record component.
      Returns:
      the value of the employeeID record component
    • sickBalance

      public int sickBalance()
      Returns the value of the sickBalance record component.
      Returns:
      the value of the sickBalance record component
    • vacationBalance

      public int vacationBalance()
      Returns the value of the vacationBalance record component.
      Returns:
      the value of the vacationBalance record component
    • paternalBalance

      public int paternalBalance()
      Returns the value of the paternalBalance record component.
      Returns:
      the value of the paternalBalance record component
    • bereavementBalance

      public int bereavementBalance()
      Returns the value of the bereavementBalance record component.
      Returns:
      the value of the bereavementBalance record component