Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


Anchor
Conversion
Conversion

...

@Conversion

The Conversion annotation must be applied at Type level.

...


Anchor
TypeConversion
TypeConversion

...

@TypeConversion

Parameter

Required

Default

Notes

property

no

The annotated property name

The optional property name used within TYPE or PACKAGE level annotations.

type

no

ConversionType.CLASS

Enum value of ConversionType. Determines whether the conversion should be applied at application or class level.

converter

yes

 

The class of the TypeConverter to be used as converter.

rule

no

ConversionRule.PROPERTY

Enum value of ConversionRule. The ConversionRule can be a property, a Collection or a Map.

...


Anchor
Validations
Validations

...

@Validations

If you want to use several annotations of the same type, these annotation must be nested within the @Validations() annotation.

...


Anchor
RequiredFieldValidator
RequiredFieldValidator

...

@RequiredFieldValidator

This validator checks that a field is non-null.

...


Anchor
RequiredStringValidator
RequiredStringValidator

...

@RequiredStringValidator

This validator checks that a String field is not empty (i.e. non-null with a length > 0).

...


Anchor
StringLengthFieldValidator
StringLengthFieldValidator

...

@StringLengthFieldValidator

This validator checks that a String field is of the right length. It assumes that the field is a String.

...


Anchor
StringRegexValidator
StringRegexValidator

...

@StringRegexValidator

This validator checks that a String field matches a configure Regular Expression, if it is not an empty String.

...


Anchor
EmailValidator
EmailValidator

...

@EmailValidator

This validator checks that a field is a valid e-mail address if it contains a non-empty String.

...


Anchor
UrlValidator
UrlValidator

...

@UrlValidator

This validator checks that a field is a valid URL.

...


Anchor
IntRangeFieldValidator
IntRangeFieldValidator

...

@IntRangeFieldValidator

This validator checks that a numeric field has a value within a specified range.

...


Anchor
DateRangeFieldValidator
DateRangeFieldValidator

...

@DateRangeFieldValidator

This validator checks that a date field has a value within a specified range.

...


Anchor
ConversionErrorFieldValidator
ConversionErrorFieldValidator

...

@ConversionErrorFieldValidator

This validator checks if there are any conversion errors for a field and applies them if they exist. See Type Conversion Error Handling for details.

...


Anchor
ExpressionValidator
ExpressionValidator

...

@ExpressionValidator

This validator uses an OGNL expression to perform its validation. The error message will be added to the action if the expression returns false when it is evaluated against the value stack.

...


Anchor
FieldExpressionValidator
FieldExpressionValidator

...

@FieldExpressionValidator

This validator uses an OGNL expression to perform its validation. The error message will be added to the field if the expression returns false when it is evaluated against the value stack.

...


Anchor
VisitorFieldValidator
VisitorFieldValidator

...

@VisitorFieldValidator

The validator allows you to forward validation to object properties of your action using the objects own validation files. This allows you to use the ModelDriven development pattern and manage your validations for your models in one place, where they belong, next to your model classes. The VisitorFieldValidator can handle either simple Object properties, Collections of Objects, or Arrays.

...

This will use the model's validation rules and any errors messages will be applied directly (nothing is prefixed because of the empty message).

More Complex Examples

An Annotated Interface

  • Mark the interface with @Validation()
  • Apply standard or custom annoations at method level

...