XmlElementWrapper (Java Platform SE 7 ) (original) (raw)

@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD})
public @interface XmlElementWrapper
Generates a wrapper element around XML representation. This is primarily intended to be used to produce a wrapper XML element around collections. The annotation therefore supports two forms of serialization shown below.
//Example: code fragment
int[] names;
// XML Serialization Form 1 (Unwrapped collection)
...
...
// XML Serialization Form 2 ( Wrapped collection )

value-of-item
value-of-item
....

The two serialized XML forms allow a null collection to be represented either by absence or presence of an element with a nillable attribute.
Usage
The @XmlElementWrapper annotation can be used with the following program elements:

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.