|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD})
@ValidatorClass(value=PropertyValidatorValidator.class)
public @interface PropertyValidatorThe validator execute validation logic on the value assigned to the property just before storing.
Applies to properties.
Example:
@PropertyValidator(UnitPriceValidator.class) private BigDecimal unitPrice;
PropertyValidator is also implemented as a Hibernate validation,
therefore it's executed when you save using JPA or Hibernate API, with the
exception of onlyOnCreate=true, in this last case the validation is only applied when
you save with OpenXava (using MapFacade or standard
OX actions).
| Required Element Summary | |
|---|---|
java.lang.Class |
value
Class with the validation logic. |
| Optional Element Summary | |
|---|---|
java.lang.String |
message
The message to be shown if validation fails. |
boolean |
onlyOnCreate
If true the validator is executed only when creating a new object, not when an existing object is modified. |
PropertyValue[] |
properties
To set values to the validator properties before executing it. |
| Element Detail |
|---|
public abstract java.lang.Class value
Must implements IPropertyValidator.
public abstract PropertyValue[] properties
public abstract boolean onlyOnCreate
public abstract java.lang.String message
The validator class have to implement IWithMessage
to receive this message.
If not specified the message is not injected in the validator, in this case the validator
should produce an appropriate default message.
You can specify an id of the messages i18n file using braces:
message="{color_not_available}"
Or directly the message:
message="That color is not available. This car can be only red or yellow"
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||