Package org.solidcoding.validation.api
Interface ReturningValidator<R>
-
public interface ReturningValidator<R>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidorElseLogError(org.slf4j.Logger logger)Users SLF4J API to log the internal failMessage at Error level.voidorElseLogInfo(org.slf4j.Logger logger)Users SLF4J API to log the internal failMessage at Info level.voidorElseLogWarn(org.slf4j.Logger logger)Users SLF4J API to log the internal failMessage at Warning level.RorElseReturn(Function<String,R> other)RorElseReturn(R other)<E extends RuntimeException>
RorElseThrow(Function<String,E> throwableFunction)
-
-
-
Method Detail
-
orElseReturn
R orElseReturn(R other)
- Parameters:
other- the backup/default return type if the validation fails.- Returns:
- R the return type.
-
orElseReturn
R orElseReturn(Function<String,R> other)
- Parameters:
other- the backup/default return type if the validation fails with the optional message that is contained in the Validator.- Returns:
- R the return type.
-
orElseThrow
<E extends RuntimeException> R 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.
-
orElseLogInfo
void orElseLogInfo(org.slf4j.Logger logger)
Users SLF4J API to log the internal failMessage at Info level.- Parameters:
logger- the logger used to log the message.
-
orElseLogWarn
void orElseLogWarn(org.slf4j.Logger logger)
Users SLF4J API to log the internal failMessage at Warning level.- Parameters:
logger- the logger used to log the message.
-
orElseLogError
void orElseLogError(org.slf4j.Logger logger)
Users SLF4J API to log the internal failMessage at Error level.- Parameters:
logger- the logger used to log the message.
-
-