Class InMemoryTaskRepository
java.lang.Object
com.guinetik.hexafun.examples.tasks.InMemoryTaskRepository
- All Implemented Interfaces:
TaskRepository
In-memory implementation of TaskRepository.
This is an adapter that implements the output port. Useful for testing and demos. In production, you'd have a JPA, JDBC, or other persistent implementation.
-
Constructor Details
-
InMemoryTaskRepository
public InMemoryTaskRepository()
-
-
Method Details
-
save
Description copied from interface:TaskRepositorySave a task (create or update).- Specified by:
savein interfaceTaskRepository- Parameters:
task- The task to save- Returns:
- The saved task
-
findById
Description copied from interface:TaskRepositoryFind a task by ID.- Specified by:
findByIdin interfaceTaskRepository- Parameters:
id- The task ID- Returns:
- The task if found
-
findAll
Description copied from interface:TaskRepositoryFind all tasks.- Specified by:
findAllin interfaceTaskRepository- Returns:
- List of all tasks
-
delete
Description copied from interface:TaskRepositoryDelete a task by ID.- Specified by:
deletein interfaceTaskRepository- Parameters:
id- The task ID- Returns:
- true if deleted, false if not found
-
clear
public void clear()Clear all tasks (useful for testing). -
count
public int count()Get the count of tasks.
-