public class TaskService extends Object
Modifier and Type | Class and Description |
---|---|
class |
TaskService.TaskNotDeletableException |
class |
TaskService.TaskNotFoundException |
Constructor and Description |
---|
TaskService() |
Modifier and Type | Method and Description |
---|---|
<T extends Task> |
add(Function<String,T> taskCreator)
Generates a new id, and adds
Task . |
void |
delete(String id)
Deletes a completed task (is done).
|
Task |
get(String id) |
List<Task> |
getAll() |
List<String> |
getIds()
NOTE: Probably will be removed in this way as linear explosion of new added tasks.
|
static TaskService |
instance() |
public static TaskService instance()
public <T extends Task> T add(Function<String,T> taskCreator)
Task
.taskCreator
- method that creates new Task
using given id.public List<String> getIds()
public Task get(String id)
TaskService.TaskNotFoundException
- if not foundpublic void delete(String id)
TaskService.TaskNotFoundException
- if not foundTaskService.TaskNotDeletableException
- if task is not in done state