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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumerates the possible leave statuses. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theemployeeIDrecord component.endDate()Returns the value of theendDaterecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.leaveID()Returns the value of theleaveIDrecord component.Returns the value of theleaveReasonrecord component.Returns the value of theleaveTyperecord component.Returns the value of therequestDaterecord component.Returns the value of thestartDaterecord component.status()Returns the value of thestatusrecord component.String[]toArray()Converts the object's attributes to a String array.final StringtoString()Returns a string representation of this record class.intReturns the value of thetotalDaysrecord component.withStatus(LeaveRecord.LEAVE_STATUS leaveStatus) Updates the leave status of the LeaveRecord.
-
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 aLeaveRecordrecord class.- Parameters:
leaveID- the value for theleaveIDrecord componentemployeeID- the value for theemployeeIDrecord componentrequestDate- the value for therequestDaterecord componentleaveType- the value for theleaveTyperecord componentstartDate- the value for thestartDaterecord componentendDate- the value for theendDaterecord componenttotalDays- the value for thetotalDaysrecord componentleaveReason- the value for theleaveReasonrecord componentstatus- the value for thestatusrecord component
-
-
Method Details
-
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
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
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
leaveID
Returns the value of theleaveIDrecord component.- Returns:
- the value of the
leaveIDrecord component
-
employeeID
public int employeeID()Returns the value of theemployeeIDrecord component.- Returns:
- the value of the
employeeIDrecord component
-
requestDate
Returns the value of therequestDaterecord component.- Returns:
- the value of the
requestDaterecord component
-
leaveType
Returns the value of theleaveTyperecord component.- Returns:
- the value of the
leaveTyperecord component
-
startDate
Returns the value of thestartDaterecord component.- Returns:
- the value of the
startDaterecord component
-
endDate
Returns the value of theendDaterecord component.- Returns:
- the value of the
endDaterecord component
-
totalDays
public int totalDays()Returns the value of thetotalDaysrecord component.- Returns:
- the value of the
totalDaysrecord component
-
leaveReason
Returns the value of theleaveReasonrecord component.- Returns:
- the value of the
leaveReasonrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-