Record Class Task
java.lang.Object
java.lang.Record
com.guinetik.hexafun.examples.tasks.Task
Immutable Task domain model with Kanban workflow status.
-
Constructor Summary
ConstructorsConstructorDescriptionTask(String id, String title, String description, TaskStatus status) Creates an instance of aTaskrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncomplete()Mark this task as completed (move to DONE).booleanCheck if this task is completed.static TaskCreate a new task with generated ID in TODO status.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.reopen()Move task back to TODO.start()Start working on this task (move to DOING).status()Returns the value of thestatusrecord component.title()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.withDescription(String newDescription) Update the description.withStatus(TaskStatus newStatus) Update the status.Update the title.
-
Constructor Details
-
Task
Creates an instance of aTaskrecord class.- Parameters:
id- the value for theidrecord componenttitle- the value for thetitlerecord componentdescription- the value for thedescriptionrecord componentstatus- the value for thestatusrecord component
-
-
Method Details
-
create
Create a new task with generated ID in TODO status. -
completed
public boolean completed()Check if this task is completed. -
start
Start working on this task (move to DOING). -
complete
Mark this task as completed (move to DONE). -
reopen
Move task back to TODO. -
withTitle
Update the title. -
withDescription
Update the description. -
withStatus
Update the 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. All components in this record class are compared withObjects::equals(Object,Object). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
title
Returns the value of thetitlerecord component.- Returns:
- the value of the
titlerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-