# ElementUnion
Date: 2013-02-18

## org.simpleframework.xml
Annotation Type ElementUnion

    @Retention(value=RUNTIME)
    public @interface ElementUnion

The `ElementUnion` annotation is used to describe fields and methods 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. This provides a means of expressing a logical OR. By annotating a field or method as a union it can take multiple forms. For example.

        @ElementUnion({
           @Element(name="circle", type=Circle.class),
           @Element(name="square", type=Square.class)
        })
        private Shape shape;

For the above definition the `Shape` field can take be any of the declared types. On deserialization the name of the element will determine the type that is instantiated and the XML structure to be consumed. For serialization the instance type will determine the name of the element the object will serialized as. This provides a useful means of consume more complicated sources.

Author:
  Niall Gallagher
See Also:
  `Element`

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

Element Detail

### value

    public abstract Element[] value

  This provides the `Element` annotations that have been defined for this union. Each element 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.

  Returns:
    the elements defined for the union declaration