velosurf.validation
Class Length
java.lang.Object
velosurf.validation.FieldConstraint
velosurf.validation.Length
public class Length
- extends FieldConstraint
A string length constraint. Syntax is:
<column min-len="min" max-len="max"/>
where you donnot need to specify both min-len and max-len.
instead of one.
Or:
<column>
<min-len value="min-value" [message="error-message"]>
<max-len value="max-value" [message="error-message"]>
</column>
Note: this constraint is not meant to replace an internal SQL constraint in the database,
since it cannot be made sure that complex updates will respect this constraint.
- Author:
- Claude Brisson
|
Constructor Summary |
Length(int minLen,
int maxLen)
Constructor. |
Length(int minLen,
int maxLen,
java.lang.String msg)
Constructor. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_minLen
protected int _minLen
_maxLen
protected int _maxLen
Length
public Length(int minLen,
int maxLen)
- Constructor.
- Parameters:
minLen - the minimum length allowed (inclusive)maxLen - the maximum length allowed (inclusive)
Length
public Length(int minLen,
int maxLen,
java.lang.String msg)
- Constructor.
- Parameters:
minLen - the minimum length allowed (inclusive)maxLen - the maximum length allowed (inclusive)msg - a string like "is not of the proper length"
setMinLength
public void setMinLength(int minLen)
setMaxLength
public void setMaxLength(int maxLen)
validate
public boolean validate(java.lang.Object data)
- Overrides:
validate in class FieldConstraint
- Parameters:
data - the data to be validated
- Returns:
- true if data is a string of the expected length
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
~ooOoo~