|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object velosurf.validation.FieldConstraint velosurf.validation.Range
public class Range
A type and range constraint on numbers. Syntax is:
<column [type="integer"] [min="min"] [max="max"]/>
where you donnot need to specify both min and max.
Or:
<integer|number [min="min-value"] [max="max-value"] [message="error-message"] />
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.
Field Summary | |
---|---|
private boolean |
integer
integer value expected. |
private static java.util.regex.Pattern |
intPattern
integer value pattern matcher. |
private java.lang.Number |
max
maximum value. |
private java.lang.Number |
min
minimum value. |
Constructor Summary | |
---|---|
Range()
Constructor. |
Method Summary | |
---|---|
void |
setInteger(boolean integer)
Whether to expect an integer or not. |
void |
setMax(java.lang.Number max)
Maximum value setter. |
void |
setMin(java.lang.Number min)
Minimum value setter. |
java.lang.String |
toString()
return a string representation for this constraint. |
boolean |
validate(java.lang.Object data)
Validate data against this constraint. |
Methods inherited from class velosurf.validation.FieldConstraint |
---|
getMessage, setMessage, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.Number min
private java.lang.Number max
private boolean integer
private static java.util.regex.Pattern intPattern
Constructor Detail |
---|
public Range()
Method Detail |
---|
public void setInteger(boolean integer)
integer
- a booleanpublic void setMin(java.lang.Number min)
min
- minimum valuepublic void setMax(java.lang.Number max)
max
- maximum valuepublic boolean validate(java.lang.Object data) throws java.sql.SQLException
validate
in class FieldConstraint
data
- the data to be validated
java.sql.SQLException
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |