Package com.atlassian.jira.web.util
Class PreValidatedActionExecutor<E>
java.lang.Object
com.atlassian.jira.web.util.PreValidatedActionExecutor<E>
- Type Parameters:
E
- Type representing validation or execution error.
Action executor with ability to run validation before executing the action.
- Since:
- v6.4
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> io.atlassian.fugue.Either<E,
T> executeFailOnFirstError
(Supplier<io.atlassian.fugue.Either<E, T>> supplier) Runs all validators and executes given supplier if all passed.withValidator
(Supplier<io.atlassian.fugue.Option<E>> validator)
-
Constructor Details
-
PreValidatedActionExecutor
public PreValidatedActionExecutor()
-
-
Method Details
-
withValidator
public PreValidatedActionExecutor<E> withValidator(Supplier<io.atlassian.fugue.Option<E>> validator) -
executeFailOnFirstError
public <T> io.atlassian.fugue.Either<E,T> executeFailOnFirstError(Supplier<io.atlassian.fugue.Either<E, T>> supplier) Runs all validators and executes given supplier if all passed. Immediately returns validation error if any validator fails, without continuing with other validation methods.- Type Parameters:
T
- Result type- Parameters:
supplier
- Action to perform when validation passes
-