Class EndingValidator<T,​R>

    • Constructor Detail

      • EndingValidator

        public EndingValidator​(Supplier<R> supplier,
                               Validator<T> businessRuleValidator)
    • Method Detail

      • orElseThrow

        public <E extends RuntimeExceptionR orElseThrow​(E throwable)
        Specified by:
        orElseThrow in interface ReturningValidator<T>
        Type Parameters:
        E - the bound of the Exception that needs to be thrown when a rule is broken.
        Parameters:
        throwable - the Exception that needs to be thrown when a rule is broken.
        Returns:
        R the return type
      • orElseReturn

        public R orElseReturn​(R other)
        Specified by:
        orElseReturn in interface ReturningValidator<T>
        Parameters:
        other - the backup/default return type if the validation fails.
        Returns:
        R the return type.