...
Parameter | Required | Default | Notes | ||||
---|---|---|---|---|---|---|---|
property key | no | The annotated property/key name | The optional property name mostly 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. | ||||
converter | either this or value |
| The class name of the TypeConverter to be used as converter. | ||||
value | either converter or this |
| The value to set for ConversionRule.KEY_PROPERTY. |
The TypeConversion annotation can be applied at property and method level.
...
Code Block | ||||
---|---|---|---|---|
| ||||
@Conversion() public class ConversionAction implements Action { private String convertInt; private String convertDouble; private List users = null; private HashMap keyValues = null; @TypeConversion(type = ConversionType.APPLICATION, converter = XWorkBasicConverter.class"com.opensymphony.xwork.util.XWorkBasicConverter") public void setConvertInt( String convertInt ) { this.convertInt = convertInt; } @TypeConversion(converter = XWorkBasicConverter.class"com.opensymphony.xwork.util.XWorkBasicConverter") public void setConvertDouble( String convertDouble ) { this.convertDouble = convertDouble; } @TypeConversion(rule = ConversionRule.COLLECTION, converter = String.class"java.util.String") public void setUsers( List users ) { this.users = users; } @TypeConversion(rule = ConversionRule.MAP, converter = BigInteger.class"java.math.BigInteger") public void setKeyValues( HashMap keyValues ) { this.keyValues = keyValues; } @TypeConversion(type = ConversionType.APPLICATION, property = "java.util.Date", converter = XWorkBasicConverter.class"com.opensymphony.xwork.util.XWorkBasicConverter") public String execute() throws Exception { return SUCCESS; } } |
...