Home > Guides > Core Developers Guide > Annotations > TypeConversion Annotation

This annotation is used for class and application wide conversion rules.

Class wide conversion:
The conversion rules will be assembled in a file called XXXAction-conversion.properties within the same package as the related action class. Set type to: type = ConversionType.CLASS

Application wide conversion:
The conversion rules will be assembled within the xwork-conversion.properties file within the classpath root. Set type to: type = ConversionType.APPLICATION

Usage

The TypeConversion annotation can be applied at property and method level.

Parameters

ParameterRequiredDefaultDescription
keynoThe annotated property/key nameThe optional property name mostly used within TYPE level annotations.
typenoConversionType.CLASSEnum value of ConversionType. Determines whether the conversion should be applied at application or class level.
rulenoConversionRule.PROPERTYEnum value of ConversionRule. The ConversionRule can be a property, a Collection or a Map.
convertereither this or value The class name of the TypeConverter to be used as converter.
valueeither converter or this The value to set for ConversionRule.KEY_PROPERTY.

Examples