Top Description Methods
org.controlsfx.validation

public Interface Validator<T>

extends BiFunction<Control, T, ValidationResult>
Type Parameters
<T>
type of the controls value
Imports
java.util.Collection, java.util.function.BiFunction, .Predicate, java.util.regex.Pattern, java.util.stream.Collectors, .Stream, javafx.scene.control.Control

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

Modifier and TypeMethod and Description
public static <T> Validator<T>

Returns:

a Validator instance
combine
(Validator<T>...
the validators to combine
validators
)

Combines the given validators into a single Validator instance.

public static <T> Validator<T>

Returns:

new validator
createEmptyValidator
(final String
text of a message to be created if value is invalid
message
,
final Severity
severity of a message to be created if value is invalid
severity
)

Factory method to create a validator, which checks if value exists.

public static <T> Validator<T>

Returns:

new validator
createEmptyValidator
(final String
of a error to be created if value is invalid
message
)

Factory method to create a validator, which checks if value exists.

public static <T> Validator<T>

Returns:

new validator
createEqualsValidator
(final String message, final Severity
severity of a message to be created if value is found
severity
,
final Collection<T>
text of a message to be created if value is not found
values
)

Factory method to create a validator, which if value exists in the provided collection.

public static <T> Validator<T>

Returns:

new validator
createEqualsValidator
(final String
text of a error to be created if value is not found
message
,
final Collection<T> values)

Factory method to create a validator, which checks if value exists in the provided collection.

public static <T> Validator<T>

Returns:

new validator
createPredicateValidator
(Predicate<T>
the predicate to be used for the value validity evaluation.
predicate
,
String
text of a message to be created if value is invalid
message
)

Factory method to create a validator, which evaluates the value validity with a given predicate.

public static <T> Validator<T>

Returns:

new validator
createPredicateValidator
(Predicate<T>
the predicate to be used for the value validity evaluation.
predicate
,
String
text of a message to be created if value is invalid
message
,
Severity
severity of a message to be created if value is invalid
severity
)

Factory method to create a validator, which evaluates the value validity with a given predicate.

public static Validator<String>

Returns:

new validator
createRegexValidator
(final String
text of a message to be created if value is invalid
message
,
final String
the regular expression the value has to match
regex
,
final Severity
severity of a message to be created if value is invalid
severity
)

Factory method to create a validator, which checks the value against a given regular expression.

public static Validator<String>

Returns:

new validator
createRegexValidator
(final String
text of a message to be created if value is invalid
message
,
final Pattern
the regular expression the value has to match
regex
,
final Severity
severity of a message to be created if value is invalid
severity
)

Factory method to create a validator, which checks the value against a given regular expression.

Inherited from java.util.function.BiFunction:
andThenapply

Method Detail

combineback to summary
public static <T> Validator<T> combine(Validator<T>... validators)

Combines the given validators into a single Validator instance.

Parameters
validators:Validator<T>[]

the validators to combine

Returns:Validator<T>

a Validator instance

Annotations
@SafeVarargs
createEmptyValidatorback to summary
public static <T> Validator<T> createEmptyValidator(final String message, final Severity severity)

Factory method to create a validator, which checks if value exists.

Parameters
message:String

text of a message to be created if value is invalid

severity:Severity

severity of a message to be created if value is invalid

Returns:Validator<T>

new validator

createEmptyValidatorback to summary
public static <T> Validator<T> createEmptyValidator(final String message)

Factory method to create a validator, which checks if value exists. Error is created if not if value does not exist

Parameters
message:String

of a error to be created if value is invalid

Returns:Validator<T>

new validator

createEqualsValidatorback to summary
public static <T> Validator<T> createEqualsValidator(final String message, final Severity severity, final Collection<T> values)

Factory method to create a validator, which if value exists in the provided collection.

Parameters
severity:Severity

severity of a message to be created if value is found

values:Collection<T>

text of a message to be created if value is not found

Returns:Validator<T>

new validator

createEqualsValidatorback to summary
public static <T> Validator<T> createEqualsValidator(final String message, final Collection<T> values)

Factory method to create a validator, which checks if value exists in the provided collection. Error is created if not found

Parameters
message:String

text of a error to be created if value is not found

Returns:Validator<T>

new validator

createPredicateValidatorback to summary
public 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. Error is created if the evaluation is false.

Parameters
predicate:Predicate<T>

the predicate to be used for the value validity evaluation.

message:String

text of a message to be created if value is invalid

Returns:Validator<T>

new validator

createPredicateValidatorback to summary
public 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 is false.

Parameters
predicate:Predicate<T>

the predicate to be used for the value validity evaluation.

message:String

text of a message to be created if value is invalid

severity:Severity

severity of a message to be created if value is invalid

Returns:Validator<T>

new validator

createRegexValidatorback to summary
public static Validator<String> createRegexValidator(final String message, final String regex, final Severity severity)

Factory method to create a validator, which checks the value against a given regular expression. Error is created if the value is null or the value does not match the pattern.

Parameters
message:String

text of a message to be created if value is invalid

regex:String

the regular expression the value has to match

severity:Severity

severity of a message to be created if value is invalid

Returns:Validator<String>

new validator

createRegexValidatorback to summary
public static Validator<String> createRegexValidator(final String message, final Pattern regex, final Severity severity)

Factory method to create a validator, which checks the value against a given regular expression. Error is created if the value is null or the value does not match the pattern.

Parameters
message:String

text of a message to be created if value is invalid

regex:Pattern

the regular expression the value has to match

severity:Severity

severity of a message to be created if value is invalid

Returns:Validator<String>

new validator