Class TaskApp

java.lang.Object
com.guinetik.hexafun.examples.tasks.TaskApp

public class TaskApp extends Object
Task application demonstrating the port registry feature.

Key concepts demonstrated:

  • Port registration: .withPort(TaskRepository.class, impl)
  • Port retrieval: app.port(TaskRepository.class)
  • Use cases using ports for persistence
  • Separation of domain logic from infrastructure

The repository is injected as a port, allowing easy swapping between in-memory (for testing) and persistent implementations.

  • Constructor Details

    • TaskApp

      public TaskApp(TaskRepository repository)
      Create a TaskApp with the given repository implementation.
  • Method Details

    • withInMemoryRepo

      public static TaskApp withInMemoryRepo()
      Create a TaskApp with an in-memory repository.
    • createTask

      public com.guinetik.hexafun.fun.Result<Task> createTask(String title, String description)
    • startTask

      public com.guinetik.hexafun.fun.Result<Task> startTask(String taskId)
    • completeTask

      public com.guinetik.hexafun.fun.Result<Task> completeTask(String taskId)
    • updateTask

      public com.guinetik.hexafun.fun.Result<Task> updateTask(String taskId, String title, String description)
    • deleteTask

      public com.guinetik.hexafun.fun.Result<Boolean> deleteTask(String taskId)
    • findTask

      public com.guinetik.hexafun.fun.Result<Task> findTask(String taskId)
    • listTasks

      public List<Task> listTasks()
    • getApp

      public com.guinetik.hexafun.HexaApp getApp()
      Get the underlying HexaApp (for testing/introspection).
    • getRepository

      public TaskRepository getRepository()
      Get the repository port directly.
    • main

      public static void main(String[] args)