Annotation Type ElementMapUnion

public @interface ElementMapUnion

The ElementMapUnion annotation is used to describe a field or method that can dynamically match a schema class. Each union can have a number of different XML class schemas matched based on an XML element name or the instance type. Here a map of element map annotations can be declared. Each annotation expresses the types the map can accept. Taking the declaration below, if the annotation is inline, the map can take a number of varying types all determined from the XML element name.

       @ElementMap(entry="x", inline=true, valueType=X.class),
       @ElementMap(entry="y", inline=true, valueType=Y.class),
       @ElementMap(entry="z", inline=true, valueType=Z.class)               
    private Map<String, Code> codes;
For the above definition the map field can take any of the declared types. On deserialization the name of the element will determine the type that is instantiated and inserted in to the map. When the map is serialized the list entry instance type will determine the name of the element the instance will serialized as. This provides a useful means of consume more complicated sources.

Niall Gallagher
See Also:

Required Element Summary
 ElementMap[] value
          This provides the ElementMap annotations that have been defined for this union.

Element Detail


public abstract ElementMap[] value
This provides the ElementMap annotations that have been defined for this union. Each element map describes the XML class schema to use and the name of the XML element. This allows the serialization process to determine which elements map to the defined types. Also, the types define how the XML is generated for a given instance.

the element maps defined for the union declaration