Top Description Constructors Methods
com.dlsc.formsfx.model.validators

public Class StringLengthValidator

extends CustomValidator<String>
Class Inheritance

A StringLengthValidator checks if a string value's length is between a minimum and a maximum value.
Authors
Sacha Schmid, Rinesch Murugathas

Constructor Summary

AccessConstructor and Description
private
StringLengthValidator(int min, int max, String errorMessage)

Method Summary

Modifier and TypeMethod and Description
public static StringLengthValidator

Returns:

Returns a new StringLengthValidator.
atLeast
(int
The lower bound for the validation.
min
,
String
The error message that is returned if the validation fails.
errorMessage
)

Creates an StringLengthValidator with a given lower bound.

public static StringLengthValidator

Returns:

Returns a new StringLengthValidator.
between
(int
The lower bound for the validation.
min
,
int
The upper bound for the validation.
max
,
String
The error message that is returned if the validation fails.
errorMessage
)

Creates an StringLengthValidator with given lower and upper bounds.

public static StringLengthValidator

Returns:

Returns a new StringLengthValidator.
exactly
(int
The lower and upper bound for the validation.
value
,
String
The error message that is returned if the validation fails.
errorMessage
)

Creates a StringLengthValidator with a given lower and upper bound, which are equal.

public static StringLengthValidator

Returns:

Returns a new StringLengthValidator.
upTo
(int
The upper bound for the validation.
max
,
String
The error message that is returned if the validation fails.
errorMessage
)

Creates an StringLengthValidator with a given upper bound.

Inherited from com.dlsc.formsfx.model.validators.CustomValidator:
forPredicatevalidate

Constructor Detail

StringLengthValidatorback to summary
private StringLengthValidator(int min, int max, String errorMessage)

Method Detail

atLeastback to summary
public static StringLengthValidator atLeast(int min, String errorMessage)

Creates an StringLengthValidator with a given lower bound.

Parameters
min:int

The lower bound for the validation.

errorMessage:String

The error message that is returned if the validation fails.

Returns:StringLengthValidator

Returns a new StringLengthValidator.

Exceptions
IllegalArgumentException:
Thrown if the minimum is a negative number.
betweenback to summary
public static StringLengthValidator between(int min, int max, String errorMessage)

Creates an StringLengthValidator with given lower and upper bounds.

Parameters
min:int

The lower bound for the validation.

max:int

The upper bound for the validation.

errorMessage:String

The error message that is returned if the validation fails.

Returns:StringLengthValidator

Returns a new StringLengthValidator.

Exceptions
IllegalArgumentException:
Thrown if the minimum is a negative number.
exactlyback to summary
public static StringLengthValidator exactly(int value, String errorMessage)

Creates a StringLengthValidator with a given lower and upper bound, which are equal.

Parameters
value:int

The lower and upper bound for the validation.

errorMessage:String

The error message that is returned if the validation fails.

Returns:StringLengthValidator

Returns a new StringLengthValidator.

upToback to summary
public static StringLengthValidator upTo(int max, String errorMessage)

Creates an StringLengthValidator with a given upper bound.

Parameters
max:int

The upper bound for the validation.

errorMessage:String

The error message that is returned if the validation fails.

Returns:StringLengthValidator

Returns a new StringLengthValidator.