Package com.guinetik.hexafun.hexa
Class UseCaseKey<I,O>
java.lang.Object
com.guinetik.hexafun.hexa.UseCaseKey<I,O>
- Type Parameters:
I- The input type of the use caseO- The output type of the use case
Type-safe key for use case registration and invocation.
Provides compile-time type checking instead of string-based dispatch.
Usage:
// Define keys as constants
public interface MyUseCases {
UseCaseKey<CreateInput, Result<Entity>> CREATE = UseCaseKey.of("create");
UseCaseKey<String, Result<Entity>> FIND = UseCaseKey.of("find");
}
// Use in DSL
HexaFun.dsl()
.useCase(MyUseCases.CREATE)
.validate(...)
.handle(...)
.build();
// Type-safe invocation
Result<Entity> result = app.invoke(MyUseCases.CREATE, input);
-
Method Summary
-
Method Details
-
of
Create a new type-safe use case key.- Type Parameters:
I- The input typeO- The output type- Parameters:
name- The unique name for this use case- Returns:
- A new UseCaseKey instance
-
name
Get the string name of this use case key.- Returns:
- The use case name
-
equals
-
hashCode
public int hashCode() -
toString
-