Package records

Record Class LeaveRecord

java.lang.Object
java.lang.Record
records.LeaveRecord

public record LeaveRecord(String leaveID, int employeeID, LocalDate requestDate, String leaveType, LocalDate startDate, LocalDate endDate, int totalDays, String leaveReason, String status) extends Record
Represents a leave record. This record contains information about an employee's leave request, including the leave ID, employee ID, request date, leave type, start date, end date, total days, leave reason, and status.

Available methods:

  • Constructor Details

    • LeaveRecord

      public LeaveRecord(String leaveID, int employeeID, LocalDate requestDate, String leaveType, LocalDate startDate, LocalDate endDate, int totalDays, String leaveReason, String status)
      Creates an instance of a LeaveRecord record class.
      Parameters:
      leaveID - the value for the leaveID record component
      employeeID - the value for the employeeID record component
      requestDate - the value for the requestDate record component
      leaveType - the value for the leaveType record component
      startDate - the value for the startDate record component
      endDate - the value for the endDate record component
      totalDays - the value for the totalDays record component
      leaveReason - the value for the leaveReason record component
      status - the value for the status record component
  • Method Details

    • toArray

      public String[] toArray()
      Converts the object's attributes to a String array.
      Returns:
      String array containing leaveID, employeeID, requestDate, leaveType, startDate, endDate, totalDays, leaveReason, and status
    • withStatus

      public LeaveRecord withStatus(LeaveRecord.LEAVE_STATUS leaveStatus)
      Updates the leave status of the LeaveRecord.
      Parameters:
      leaveStatus - the new leave status to be set
      Returns:
      the updated LeaveRecord with the new leave status
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • leaveID

      public String leaveID()
      Returns the value of the leaveID record component.
      Returns:
      the value of the leaveID record component
    • employeeID

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

      public LocalDate requestDate()
      Returns the value of the requestDate record component.
      Returns:
      the value of the requestDate record component
    • leaveType

      public String leaveType()
      Returns the value of the leaveType record component.
      Returns:
      the value of the leaveType record component
    • startDate

      public LocalDate startDate()
      Returns the value of the startDate record component.
      Returns:
      the value of the startDate record component
    • endDate

      public LocalDate endDate()
      Returns the value of the endDate record component.
      Returns:
      the value of the endDate record component
    • totalDays

      public int totalDays()
      Returns the value of the totalDays record component.
      Returns:
      the value of the totalDays record component
    • leaveReason

      public String leaveReason()
      Returns the value of the leaveReason record component.
      Returns:
      the value of the leaveReason record component
    • status

      public String status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component