Interface ContinuingValidator<T>


  • public interface ContinuingValidator<T>
    • Method Detail

      • getMessage

        String getMessage()
        Returns:
        the failure message;
      • validate

        boolean validate()
        Returns:
        boolean true if all rules pass. False if at least one rule fails.
      • andThen

        <R> ReturningValidator<R> andThen​(Supplier<R> supplier)
        Same as validate(); but returns a custom object in the form of a supplier.
        Type Parameters:
        R - the type you wish to return.
        Parameters:
        supplier - the supplier which encapsulated the return type.
        Returns:
        R in the form of a supplier.
      • orElseThrow

        <E extends RuntimeException> boolean orElseThrow​(Function<String,​E> throwableFunction)
        Type Parameters:
        E - the bound of the Exception that needs to be thrown when a rule is broken.
        Parameters:
        throwableFunction - the function defining the Exception that needs to be thrown when a rule is broken. The String is the stored failure message of the validation.
        Returns:
        true if all rules pass.
      • orElseReturn

        T orElseReturn​(T other)
        Parameters:
        other - the backup/default return type if the validation fails.
        Returns:
        T the return type.
      • orElseReturn

        T orElseReturn​(Function<String,​T> other)
        Parameters:
        other - the backup/default return type if the validation fails with the optional message that is contained in the Validator.
        Returns:
        T the return type.