In many places, applications can use use Java 5 annotations as an alternative to XML and Java properties configuration. This page serves as a reference for all annotations across the framework.
Action Annotations
Action annotations are available when the framework scans the classpath for Action classes, rather than specifying individual mappings through XML configuration.
Annotation |
Description |
---|---|
Overrides the namespace of an action |
|
Defines an existing configuration package for the action's package to extend |
|
Defines an action Result |
|
Defines multiple Results |
Interceptor Annotations
To use these annotations, you have to specify the AnnotationWorkflowInterceptor to your interceptor stack.
Annotation |
Description |
---|---|
Marks a action method that needs to be executed after the result. |
|
Marks a action method that needs to be executed before the main action method. |
|
Marks a action method that needs to be executed before the result. |
Validation Annotations
To use annotation-based validation, annotate the class or interface with Validation Annotation.
Annotation |
Description |
---|---|
Checks if there are any conversion errors for a field. |
|
Checks that a date field has a value within a specified range. |
|
Checks that a double field has a value within a specified range. |
|
Checks that a field is a valid e-mail address. |
|
Validates an expression. |
|
Uses an OGNL expression to perform its validator. |
|
Checks that a numeric field has a value within a specified range. |
|
Validates a regular expression for a field. |
|
Checks that a field is non-null. |
|
Checks that a String field is not empty. |
|
Checks that a String field is of the right length. |
|
Invokes a regular expression to validate a String field. |
|
Checks that a field is a valid URL. |
|
Marker annotation for validation at Type level. |
|
Used to group validation annotations. |
|
Invokes the validation for a property's object type. |
|
Use this annotation for your custom validator types. |
Type Conversion Annotations
By default, type conversion for Maps and Collections using generics is directly supported.
In short, instead of specifying the types found in collections and maps as documented in Type Conversion, the collection's generic type is used. By using annotations, an application should be able avoid using any ClassName-conversion.properties
files.
To use annotation-based type conversion, annotate the class or interface with the Conversion Annotation.
Annotation |
Description |
---|---|
Marker annotation for type conversions at Type level. |
|
For Collection and Map types: Create the types within the Collection or Map, if null. |
|
For Generic types: Specify the element type for Collection types and Map values. |
|
For Generic types: Specify the key type for Map keys. |
|
For Generic types: Specify the key property name value. |
|
Used for class and application wide conversion rules. |