|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Documented @Retention(value=RUNTIME) @Target(value={FIELD,PARAMETER,METHOD}) @Constraint(checkWith=DigitsCheck.class) public @interface Digits
Check if the String representation has the given max/min number of integral and fractional digits.
Note: This constraint is also satisfied when the value to validate is null, therefore you might also need to specified @NotNull
Optional Element Summary | |
---|---|
ConstraintTarget[] |
appliesTo
In case the constraint is declared for an array, collection or map this controls how the constraint is applied to it and it's child objects. |
String |
errorCode
error code passed to the ConstraintViolation object |
int |
maxFraction
|
int |
maxInteger
|
String |
message
message to be used for the ContraintsViolatedException |
int |
minFraction
|
int |
minInteger
|
String[] |
profiles
The associated constraint profiles. |
int |
severity
severity passed to the ConstraintViolation object |
String |
target
An expression to specify where in the object graph relative from this object the expression should be applied. |
String |
when
Formula returning true if this constraint shall be evaluated and
false if it shall be ignored for the current validation. |
public abstract ConstraintTarget[] appliesTo
In case the constraint is declared for an array, collection or map this controls how the constraint is applied to it and it's child objects.
Default: ConstraintTarget.VALUES
Note: This setting is ignored for object types other than array, map and collection.
public abstract String errorCode
public abstract int maxFraction
public abstract int maxInteger
public abstract String message
ConstraintViolation
public abstract int minFraction
public abstract int minInteger
public abstract String[] profiles
public abstract int severity
public abstract String target
Examples:
owner
owner
's property id
public abstract String when
true
if this constraint shall be evaluated and
false
if it shall be ignored for the current validation.
Important: The formula must be prefixed with the name of the scripting language that is used.
E.g. groovy:_this.amount > 10
Available context variables are:
_this -> the validated bean
_value -> the value to validate (e.g. the field value, parameter value, method return value,
or the validated bean for object level constraints)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |