Interface TaskRepository

All Known Implementing Classes:
InMemoryTaskRepository

public interface TaskRepository
Output port for task persistence.

This is the interface that use cases depend on. Implementations (adapters) provide the actual storage mechanism.

  • Method Details

    • save

      Task save(Task task)
      Save a task (create or update).
      Parameters:
      task - The task to save
      Returns:
      The saved task
    • findById

      Optional<Task> findById(String id)
      Find a task by ID.
      Parameters:
      id - The task ID
      Returns:
      The task if found
    • findAll

      List<Task> findAll()
      Find all tasks.
      Returns:
      List of all tasks
    • delete

      boolean delete(String id)
      Delete a task by ID.
      Parameters:
      id - The task ID
      Returns:
      true if deleted, false if not found
    • exists

      default boolean exists(String id)
      Check if a task exists.
      Parameters:
      id - The task ID
      Returns:
      true if exists