|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.millstone.base.data.validator.StringLengthValidator
This validator is used to validate the lenght of strings.
Nested Class Summary |
Nested classes inherited from class org.millstone.base.data.Validator |
Validator.InvalidValueException, Validator.Suggestive |
Constructor Summary | |
StringLengthValidator(java.lang.String errorMessage)
Create a new StringLengthValidator with a given error message. |
|
StringLengthValidator(java.lang.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 | |
java.lang.String |
getErrorMessage()
Gets the message to be displayed in case the value does not validate. |
int |
getMaxLength()
Get the maximum permissable length of the string. |
int |
getMinLength()
Get the minimum permissable lenght of the string. |
boolean |
isNullAllowed()
True if null strings are allowed. |
boolean |
isValid(java.lang.Object value)
True if the value is valid. |
void |
setErrorMessage(java.lang.String errorMessage)
Sets the message to be displayer in case the value does not validate. |
void |
setMaxLength(int maxLength)
Set the maximum permissable length of the string. |
void |
setMinLength(int minLength)
Sets the minimum permissable lenght. |
void |
setNullAllowed(boolean allowNull)
Sets wheter null-strings are to be allowed. |
void |
validate(java.lang.Object value)
Validate the value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StringLengthValidator(java.lang.String errorMessage)
errorMessage
- - The message to display in case the value does not validate.public StringLengthValidator(java.lang.String errorMessage, int minLength, int maxLength, boolean allowNull)
errorMessage
- - The message to display in case the value does not validate.allowNull
- - Are null strings permissable?Method Detail |
public void validate(java.lang.Object value) throws Validator.InvalidValueException
validate
in interface Validator
value
- - The value to validate.
Validator.InvalidValueException
- if the value is not validpublic boolean isValid(java.lang.Object value)
isValid
in interface Validator
value
- - The value to validate.public final boolean isNullAllowed()
public final int getMaxLength()
public final int getMinLength()
public void setNullAllowed(boolean allowNull)
public void setMaxLength(int maxLength)
public void setMinLength(int minLength)
public java.lang.String getErrorMessage()
public void setErrorMessage(java.lang.String errorMessage)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |