# Convert
Date: 2013-02-18

## org.simpleframework.xml.convert
Annotation Type Convert

    @Retention(value=RUNTIME)
    public @interface Convert

The `Convert` annotation is used to specify a converter class to use for serialization. This annotation is used when an object needs to be serialized but can not be annotated or when the object can not conform to an existing XML structure. In order to specify a `Converter` object a field or method can be annotated like the field below.

        @Element
        @Convert(ExampleConverter.class)
        private Example example;

Note that for the above field the `Element` annotation is required. If this is used with any other XML annotation such as the `ElementList` or `Text` annotation then an exception will be thrown. As well as field and methods this can be used to suggest a converter for a class. Take the class below which is annotated.

        @Root
        @Convert(DemoConverter.class)
        public class Demo {
           ...
        }

For the above class the specified converter will be used. This is useful when the class is used within a `java.util.List` or another similar collection. Finally, in order for this to work it must be used with the `AnnotationStrategy` which is used to scan for annotations in order to delegate to converters.

Author:
  Niall Gallagher
See Also:
  `AnnotationStrategy`

Required Element Summary
`java.lang.Class<? extends Converter>` `value` Specifies the `Converter` implementation to be used to convert the annotated object.

Element Detail

### value

    public abstract java.lang.Class<? extends Converter> value

  Specifies the `Converter` implementation to be used to convert the annotated object. The converter specified will be used to convert the object to XML by intercepting the serialization and deserialization process as it happens. A converter should typically be used to handle an object of a specific type.

  Returns:
    this returns the converter that has been specified