org.openxava.annotations
Annotation Type PropertyValidator


@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD})
@ValidatorClass(value=PropertyValidatorValidator.class)
public @interface PropertyValidator

The 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).

Author:
Javier Paniza

Required Element Summary
 java.lang.Class value
          Class with the validation logic.
 
Optional Element Summary
 java.lang.String message
           
 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

value

public abstract java.lang.Class value
Class with the validation logic.

Must implements IPropertyValidator.

properties

public abstract PropertyValue[] properties
To set values to the validator properties before executing it.

Default:
{}

onlyOnCreate

public abstract boolean onlyOnCreate
If true the validator is executed only when creating a new object, not when an existing object is modified.

Default:
false

message

public abstract java.lang.String message
Default:
"openxava.propertyValidator"