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 enum
Enumerates the possible leave statuses. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the value of theemployeeID
record component.endDate()
Returns the value of theendDate
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.leaveID()
Returns the value of theleaveID
record component.Returns the value of theleaveReason
record component.Returns the value of theleaveType
record component.Returns the value of therequestDate
record component.Returns the value of thestartDate
record component.status()
Returns the value of thestatus
record component.String[]
toArray()
Converts the object's attributes to a String array.final String
toString()
Returns a string representation of this record class.int
Returns the value of thetotalDays
record 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 aLeaveRecord
record class.- Parameters:
leaveID
- the value for theleaveID
record componentemployeeID
- the value for theemployeeID
record componentrequestDate
- the value for therequestDate
record componentleaveType
- the value for theleaveType
record componentstartDate
- the value for thestartDate
record componentendDate
- the value for theendDate
record componenttotalDays
- the value for thetotalDays
record componentleaveReason
- the value for theleaveReason
record componentstatus
- the value for thestatus
record 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 theleaveID
record component.- Returns:
- the value of the
leaveID
record component
-
employeeID
public int employeeID()Returns the value of theemployeeID
record component.- Returns:
- the value of the
employeeID
record component
-
requestDate
Returns the value of therequestDate
record component.- Returns:
- the value of the
requestDate
record component
-
leaveType
Returns the value of theleaveType
record component.- Returns:
- the value of the
leaveType
record component
-
startDate
Returns the value of thestartDate
record component.- Returns:
- the value of the
startDate
record component
-
endDate
Returns the value of theendDate
record component.- Returns:
- the value of the
endDate
record component
-
totalDays
public int totalDays()Returns the value of thetotalDays
record component.- Returns:
- the value of the
totalDays
record component
-
leaveReason
Returns the value of theleaveReason
record component.- Returns:
- the value of the
leaveReason
record component
-
status
Returns the value of thestatus
record component.- Returns:
- the value of the
status
record component
-