Package com.guinetik.hexafun.hexa
Class UseCaseValidationStep<I>
java.lang.Object
com.guinetik.hexafun.hexa.UseCaseValidationStep<I>
- Type Parameters:
I- The input type of the use case
Builder step for defining validation and handler logic.
Supports chaining multiple validators that execute in order:
.useCase(Keys.ADD)
.validate(Validators::validateCounter)
.validate(Validators::validateAmount)
.handle(input -> ...)
-
Constructor Summary
ConstructorsConstructorDescriptionUseCaseValidationStep(String name, UseCaseBuilder builder, ValidationPort<I> validator) -
Method Summary
Modifier and TypeMethodDescription<O> UseCaseBuilderDefine the handler that runs after all validators pass.validate(ValidationPort<I> validator) Add another validator to the chain.
-
Constructor Details
-
UseCaseValidationStep
-
-
Method Details
-
validate
Add another validator to the chain. Validators execute in order; first failure short-circuits.- Parameters:
validator- The next validation port- Returns:
- This step for further chaining
-
handle
Define the handler that runs after all validators pass.- Type Parameters:
O- The output type of the handler- Parameters:
handler- The use case logic that processes the validated input- Returns:
- The builder for chaining more use cases
-