Class Task

java.lang.Object
com.homannsoftware.tasks.task.Task

@Entity public class Task extends Object
A persisted task with a title and an irreversible completion state. The version field lets JPA reject stale updates; it is not part of the API.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates an uninitialized instance for the JPA persistence provider.
     
    Task(String title)
    Creates an incomplete task and strips surrounding whitespace from its title.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Marks this task completed; repeated calls leave it completed.
    Reads the identity assigned by persistence.
    Reads the task title.
    boolean
    Reads the task's completion state.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Task

      protected Task()
      Creates an uninitialized instance for the JPA persistence provider.
    • Task

      public Task(String title)
      Creates an incomplete task and strips surrounding whitespace from its title.
      Parameters:
      title - nonblank title, at most 120 UTF-16 code units before stripping
      Throws:
      IllegalArgumentException - if the title is null, blank or too long
  • Method Details

    • complete

      public void complete()
      Marks this task completed; repeated calls leave it completed.
    • getId

      public Long getId()
      Reads the identity assigned by persistence.
      Returns:
      database-generated identity, or null before one is assigned
    • getTitle

      public String getTitle()
      Reads the task title.
      Returns:
      normalized title after construction or persistence loading
    • isCompleted

      public boolean isCompleted()
      Reads the task's completion state.
      Returns:
      whether completion has been recorded for this task