- Type Parameters:
T
- type of the controls value
- All Superinterfaces:
BiFunction<javafx.scene.control.Control,
T, ValidationResult>
Interface defining the contract for validation of specific component
This interface is a
BiFunction
which when given the control and its current value
computes the validation result-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T> Validator
<T> Combines the given validators into a single Validator instance.static <T> Validator
<T> createEmptyValidator
(String message) Factory method to create a validator, which checks if value exists.static <T> Validator
<T> createEmptyValidator
(String message, Severity severity) Factory method to create a validator, which checks if value exists.static <T> Validator
<T> createEqualsValidator
(String message, Collection<T> values) Factory method to create a validator, which checks if value exists in the provided collection.static <T> Validator
<T> createEqualsValidator
(String message, Severity severity, Collection<T> values) Factory method to create a validator, which if value exists in the provided collection.static <T> Validator
<T> createPredicateValidator
(Predicate<T> predicate, String message) Factory method to create a validator, which evaluates the value validity with a given predicate.static <T> Validator
<T> createPredicateValidator
(Predicate<T> predicate, String message, Severity severity) Factory method to create a validator, which evaluates the value validity with a given predicate.createRegexValidator
(String message, String regex, Severity severity) Factory method to create a validator, which checks the value against a given regular expression.createRegexValidator
(String message, Pattern regex, Severity severity) Factory method to create a validator, which checks the value against a given regular expression.Methods inherited from interface java.util.function.BiFunction
andThen, apply
-
Method Details
-
combine
Combines the given validators into a single Validator instance.- Parameters:
validators
- the validators to combine- Returns:
- a Validator instance
-
createEmptyValidator
Factory method to create a validator, which checks if value exists.- Parameters:
message
- text of a message to be created if value is invalidseverity
- severity of a message to be created if value is invalid- Returns:
- new validator
-
createEmptyValidator
Factory method to create a validator, which checks if value exists. Error is created if not if value does not exist- Parameters:
message
- of a error to be created if value is invalid- Returns:
- new validator
-
createEqualsValidator
static <T> Validator<T> createEqualsValidator(String message, Severity severity, Collection<T> values) Factory method to create a validator, which if value exists in the provided collection.- Parameters:
severity
- severity of a message to be created if value is foundvalues
- text of a message to be created if value is not found- Returns:
- new validator
-
createEqualsValidator
Factory method to create a validator, which checks if value exists in the provided collection. Error is created if not found- Parameters:
message
- text of a error to be created if value is not foundvalues
-- Returns:
- new validator
-
createPredicateValidator
Factory method to create a validator, which evaluates the value validity with a given predicate. Error is created if the evaluation isfalse
.- Parameters:
predicate
- the predicate to be used for the value validity evaluation.message
- text of a message to be created if value is invalid- Returns:
- new validator
-
createPredicateValidator
static <T> Validator<T> createPredicateValidator(Predicate<T> predicate, String message, Severity severity) Factory method to create a validator, which evaluates the value validity with a given predicate. Error is created if the evaluation isfalse
.- Parameters:
predicate
- the predicate to be used for the value validity evaluation.message
- text of a message to be created if value is invalidseverity
- severity of a message to be created if value is invalid- Returns:
- new validator
-
createRegexValidator
Factory method to create a validator, which checks the value against a given regular expression. Error is created if the value isnull
or the value does not match the pattern.- Parameters:
message
- text of a message to be created if value is invalidregex
- the regular expression the value has to matchseverity
- severity of a message to be created if value is invalid- Returns:
- new validator
-
createRegexValidator
Factory method to create a validator, which checks the value against a given regular expression. Error is created if the value isnull
or the value does not match the pattern.- Parameters:
message
- text of a message to be created if value is invalidregex
- the regular expression the value has to matchseverity
- severity of a message to be created if value is invalid- Returns:
- new validator
-