org.barracudamvc.core.forms.validators
Class MaxLengthValidator
java.lang.Object
org.barracudamvc.core.forms.AbstractFormValidator
org.barracudamvc.core.forms.DefaultFormValidator
org.barracudamvc.core.forms.validators.MaxLengthValidator
- All Implemented Interfaces:
- FormValidator
- public class MaxLengthValidator
- extends DefaultFormValidator
This validator ensures that the length of a value is <= a maximum length
Field Summary |
protected int |
max
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
max
protected int max
MaxLengthValidator
public MaxLengthValidator()
- Public no-args constructor.
MaxLengthValidator
public MaxLengthValidator(int imax)
- Public constructor.
- Parameters:
imax
- the max length
MaxLengthValidator
public MaxLengthValidator(int imax,
String ierrmsg)
- Public constructor.
- Parameters:
imax
- the max lengthierrmsg
- the message associated with this error
getMaxLength
public int getMaxLength()
- Get the maximum allowable length
- Returns:
- The maximum allowable length of this field.
validateFormElement
public void validateFormElement(Object val,
FormElement element,
boolean deferExceptions)
throws ValidationException
- Validate a FormElement to make sure the length of element does not
exceed a Max length. Validation is not supported for FormType.BOOLEAN
and FormType.DATE
- Overrides:
validateFormElement
in class DefaultFormValidator
- Parameters:
val
- the value to compare the element value toelement
- the form element that contains the val
to validate elements by comparing them with other elements)deferExceptions
- do we want to deferValidation exceptions
and attempt to validate all elements so that we can process
all the exceptions at once
- Throws:
ValidationException
- if the element is not valid
Copyright © 2004 BarracudaMVC.org All Rights Reserved.