Interface Validated.Accumulator<E>

Enclosing interface:
Validated<E,T>

public static interface Validated.Accumulator<E>
The binding handle passed to Validated.accumulate(Function).
  • Method Details

    • on

      <T> Validated.Bound<T> on(Validated<E,T> validated)
      Bind a Validated: a Valid's value becomes available via Validated.Bound.value(); an Invalid's errors are added to the accumulator. Binding never aborts the block; later validations still run.
    • on

      default <T> Validated.Bound<T> on(Result<E,T> result)
      Bind a Result: Err accumulates as a single error.
    • on

      default <T> Validated.Bound<T> on(Optional<? extends T> maybe, Supplier<? extends E> ifEmpty)
      Bind an Optional: empty accumulates ifEmpty.get().
    • onEach

      default <T,R> Validated.Bound<List<R>> onEach(List<? extends T> items, Function<? super T, ? extends Validated<E,R>> parse)
      Bind a validation of every element of a list (on of a traverse): every failing element contributes its errors, and the Validated.Bound yields the fully-parsed list.
    • ensure

      default void ensure(boolean condition, Supplier<? extends E> error)
      Check a condition with no value to bind: a guard, a limit, a cross-field rule. false records the error and the block keeps running, like every other binding; true records nothing.