| Constructor and Description |
|---|
RegexRule() |
| Modifier and Type | Method and Description |
|---|---|
R |
blocking(boolean blocking)
Define whether the Rule is blocking or not.
|
RegexRule |
flags(int flags) |
protected java.lang.String |
getMessage()
Get the error message
|
protected java.util.function.Predicate<java.lang.String> |
getValidation()
Get the validation contract
|
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.
|
RegexRule |
pattern(java.lang.String pattern) |
protected boolean |
skipValidation(T value)
Determine whether validation should be skipped for the given value
|
RuleResponse |
validate(T value)
Validate a given value using this Rule
|
protected R |
validation(java.util.function.Predicate<T> validation)
Provides the validation to be performed in order to determine whether the value is valid
|
public RegexRule pattern(java.lang.String pattern)
public RegexRule flags(int flags)
protected java.util.function.Predicate<java.lang.String> getValidation()
Predicate with the rule contractprotected java.lang.String getMessage()
public R message(java.lang.String message)
RuleRuleResponse when the Rule validation fails.protected R validation(java.util.function.Predicate<T> validation)
validation - a Predicate that is the contract to when a value is validpublic R blocking(boolean blocking)
RuleWhen 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.
public R optional(boolean optional)
RuleAn optional Rule is being skipped when the value to be validated is null.
public RuleResponse validate(T value)
Ruleprotected boolean skipValidation(T value)
value - the object for which the validation will take placepublic boolean isBlocking()
Ruleblocking or not.isBlocking in interface Rule<T,R extends Rule>