Class StringLengthValidator

This validator is used to validate the lenght of strings.

Synopsis

Since

3.0

Inheritance Path.  java.lang.Object-> com.itmill.toolkit.data.validator.StringLengthValidator

StringLengthValidator(String)

Parameters

errorMessage

- The message to display in case the value does not validate.

Create a new StringLengthValidator with a given error message.

StringLengthValidator(String, int, int, boolean)

Parameters

errorMessage

- The message to display in case the value does not validate.

minLenght

- The minimum permissable lenght of the string.

maxLenght

- The maximum permissable lenght of the string.

allowNull

- Are null strings permissable?

Create a new StringLenghtValidator with a given error message, permissable lenghts and null-string allowance.

getErrorMessage()

Gets the message to be displayed in case the value does not validate.

getMaxLength()

Get the maximum permissable length of the string.

getMinLength()

Get the minimum permissable lenght of the string.

isNullAllowed()

True if null strings are allowed.

isValid(Object)

Parameters

value

- The value to validate.

True if the value is valid.

setErrorMessage(String)

Sets the message to be displayer in case the value does not validate.

setMaxLength(int)

Parameters

maxLenght

- The lenght to set.

Set the maximum permissable length of the string.

setMinLength(int)

Parameters

minLenght

- The lenght to set.

Sets the minimum permissable lenght.

setNullAllowed(boolean)

Sets wheter null-strings are to be allowed.

validate(Object)

Parameters

value

- The value to validate.

Validate the value.