Class RuleBuilder<V>
java.lang.Object
com.atlassian.crowd.embedded.validator.rule.RuleBuilder<V>
- Type Parameters:
V
- Entity type to be validated
- Direct Known Subclasses:
DirectoryRuleBuilder
,MailServerRuleBuilder
Builder class which facilitates creation of
ValidationRule
- Since:
- 3.2.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build theValidationRule
with the supplied value functions and their corresponding predicates, all of which must be positively tested to generate aaerror
<M> RuleBuilder<V>
Adds the value function, with the corresponding predicate to the checks listAdds the value function, with the corresponding predicate to the checks listgreaterThanOrEquals
(Long number) ifMatchesThenSet
(Function<V, String> messageFunction) Sets the message function, which will be used to get the actual error message for the field errorifMatchesThenSet
(Supplier<String> messageSupplier) Sets the message supplier, which will be used to get the actual error message for the field errorinLongRange
(Long min, Long max) isNull()
static <K> Predicate<K>
matchesAll
(Predicate<K>... predicates) static <K> Predicate<K>
matchesAny
(Predicate<K>... predicates) message
(I18nHelper i18nHelper, String messageKey) static <K> Predicate<K>
notNull()
Utility method which returns the predicate for matching any string value to the given regex pattern.
-
Constructor Details
-
RuleBuilder
-
-
Method Details
-
regex
Utility method which returns the predicate for matching any string value to the given regex pattern.- Parameters:
pattern
- The pattern to which the string is to be tested against- Returns:
- The generated predicate which tests an input string to specified regex
-
notNull
-
isNull
-
eq
-
not
-
matchesAny
-
matchesAll
-
message
-
isValidURI
-
inLongRange
-
greaterThanOrEquals
-
isValidRegex
-
check
Adds the value function, with the corresponding predicate to the checks list- Parameters:
valueRetriever
- The value function to be used to retrieve valuepredicate
- The predicate to be tested against the retrieved value fromFunction
- Returns:
- Current builder instance
-
check
Adds the value function, with the corresponding predicate to the checks list- Parameters:
valueRetriever
- Predicate which will be used to check conditionexpectedValue
- The value which will be compare in predicate- Returns:
- Current builder instance
-
ifMatchesThenSet
Sets the message supplier, which will be used to get the actual error message for the field error- Parameters:
messageSupplier
- The supplier for the error message- Returns:
- Current builder's instance
-
ifMatchesThenSet
Sets the message function, which will be used to get the actual error message for the field error- Parameters:
messageFunction
- the function, which will be used to get proper error message- Returns:
- Current builder's instance
-
build
Build theValidationRule
with the supplied value functions and their corresponding predicates, all of which must be positively tested to generate aaerror
- Returns:
ValidationRule
A rule that can be applied on theRuleBuilder
entity to be validated
-