Annotation Type XStreamConverter
-
@Retention(RUNTIME) @Target({TYPE,FIELD}) @Documented public @interface XStreamConverter
Annotation to declare a converter. The annotation supports additionally the injection of various constructor arguments provided by XStream:Mapper
: The current mapper chain of the XStream instance.ClassLoaderReference
: The reference to the class loader used by the XStream instance to deserialize the objects.ReflectionProvider
: The reflection provider used by the reflection based converters of the current XStream instance.ConverterLookup
: The lookup for converters handling a special type.- All elements provided with the individual arrays of this annotation. The provided values follow the declaration sequence if a constructor requires multiple arguments of the same type.
Class
: The type of the element where the annotation is declared. Note, that this argument is not supported when usingXStreamConverters
oruseImplicitType()
== false.JVM
: Utility e.g. to load classes.ClassLoader
(deprecated since 1.4.5): The class loader used by the XStream instance to deserialize the objects. Use ClassLoaderReference as argument
The algorithm will try the converter's constructor with the most arguments first.
Note, the annotation matches a
ConverterMatcher
.Converter
as well asSingleValueConverter
extend this interface. TheAnnotationMapper
can only handle these two known types.
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.Class<? extends ConverterMatcher>
value
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean[]
booleans
byte[]
bytes
char[]
chars
double[]
doubles
float[]
floats
int[]
ints
long[]
longs
java.lang.Class<?>[]
nulls
Provide null types as arguments for the converter's constructor arguments.int
priority
short[]
shorts
java.lang.String[]
strings
java.lang.Class<?>[]
types
Provide class types as arguments for the converter's constructor arguments.boolean
useImplicitType
Flag to provide the current type as implicit first Class argument to a converter's constructor.
-
-
-
Element Detail
-
value
java.lang.Class<? extends ConverterMatcher> value
-
-
-
types
java.lang.Class<?>[] types
Provide class types as arguments for the converter's constructor arguments.Note, that XStream itself provides the current class type as first Class argument to a constructor, if the annotation is added directly to a class type (and not as part of a parameter declaration of a
XStreamConverters
annotation). The current type has precedence over any type provided with this method. This behavior can be overridden settinguseImplicitType()
to false.- Returns:
- the types
- Since:
- 1.4.2
- Default:
- {}
-
-