| java.lang.Object org.millstone.base.data.validator.StringLengthValidator
StringLengthValidator | public class StringLengthValidator implements Validator(Code) | | This validator is used to validate the lenght of strings.
author: IT Mill Ltd. version: 3.1.1 since: 3.0 |
Constructor Summary | |
public | StringLengthValidator(String errorMessage) Create a new StringLengthValidator with a given error message. | public | StringLengthValidator(String errorMessage, int minLength, int maxLength, boolean allowNull) Create a new StringLenghtValidator with a given error message,
permissable lenghts and null-string allowance. |
Method Summary | |
public String | getErrorMessage() Gets the message to be displayed in case the
value does not validate. | final public int | getMaxLength() Get the maximum permissable length of the string. | final public int | getMinLength() Get the minimum permissable lenght of the string. | final public boolean | isNullAllowed() True if null strings are allowed. | public boolean | isValid(Object value) True if the value is valid. | public void | setErrorMessage(String errorMessage) Sets the message to be displayer in case the
value does not validate. | public void | setMaxLength(int maxLength) Set the maximum permissable length of the string. | public void | setMinLength(int minLength) Sets the minimum permissable lenght. | public void | setNullAllowed(boolean allowNull) Sets wheter null-strings are to be allowed. | public void | validate(Object value) Validate the value. |
StringLengthValidator | public StringLengthValidator(String errorMessage)(Code) | | Create a new StringLengthValidator with a given error message.
Parameters: errorMessage - - The message to display in case the value does not validate. |
StringLengthValidator | public StringLengthValidator(String errorMessage, int minLength, int maxLength, boolean allowNull)(Code) | | Create a new StringLenghtValidator with a given error message,
permissable lenghts and null-string allowance.
Parameters: errorMessage - - The message to display in case the value does not validate. Parameters: minLenght - - The minimum permissable lenght of the string. Parameters: maxLenght - - The maximum permissable lenght of the string. Parameters: allowNull - - Are null strings permissable? |
getErrorMessage | public String getErrorMessage()(Code) | | Gets the message to be displayed in case the
value does not validate.
|
getMaxLength | final public int getMaxLength()(Code) | | Get the maximum permissable length of the string.
|
getMinLength | final public int getMinLength()(Code) | | Get the minimum permissable lenght of the string.
|
isNullAllowed | final public boolean isNullAllowed()(Code) | | True if null strings are allowed.
|
isValid | public boolean isValid(Object value)(Code) | | True if the value is valid.
Parameters: value - - The value to validate. |
setErrorMessage | public void setErrorMessage(String errorMessage)(Code) | | Sets the message to be displayer in case the
value does not validate.
|
setMaxLength | public void setMaxLength(int maxLength)(Code) | | Set the maximum permissable length of the string.
Parameters: maxLenght - - The lenght to set. |
setMinLength | public void setMinLength(int minLength)(Code) | | Sets the minimum permissable lenght.
Parameters: minLenght - - The lenght to set. |
setNullAllowed | public void setNullAllowed(boolean allowNull)(Code) | | Sets wheter null-strings are to be allowed.
|
|
|