T - The Class of the value to be validatedR - A Rule Class itself, used for generic purposespublic interface Rule<T,R extends Rule>
| Modifier and Type | Method and Description |
|---|---|
R |
blocking(boolean blocking)
Define whether the Rule is blocking or not.
|
boolean |
isBlocking()
Check whether the Rule is
blocking or not. |
R |
message(java.lang.String message)
Define the custom error message added in the
RuleResponse when the Rule validation fails. |
R |
optional(boolean optional)
Define whether the Rule is optional or not.
|
RuleResponse |
validate(T value)
Validate a given value using this Rule
|
R message(java.lang.String message)
RuleResponse when the Rule validation fails.message - String with custom error messageR blocking(boolean blocking)
When a blocking Rule is being processed in the Rules chain and fails, the validation immediately stops for the given Object (at the given level) and immediately returns without continuing to the next Rules.
blocking - boolean denoting whether Rule is blocking or nullR optional(boolean optional)
An optional Rule is being skipped when the value to be validated is null.
optional - boolean denoting whether Rule is optionalRuleResponse validate(T value)
value - object to be validatedboolean isBlocking()
blocking or not.