20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javax.xml.bind.annotation;
27
28 import java.lang.annotation.Retention;
29 import java.lang.annotation.Target;
30 import static java.lang.annotation.RetentionPolicy.RUNTIME;
31 import static java.lang.annotation.ElementType.FIELD;
32 import static java.lang.annotation.ElementType.METHOD;
33 import static java.lang.annotation.ElementType.PARAMETER;
34
35 /**
36 * Used to map a property to a list simple type.
37 *
38 * <p><b>Usage</b> </p>
39 * <p>
40 * The <tt>@XmlList</tt> annotation can be used with the
41 * following program elements:
42 * <ul>
43 * <li> JavaBean property </li>
44 * <li> field </li>
45 * </ul>
46 *
47 * <p>
48 * When a collection property is annotated just with @XmlElement,
49 * each item in the collection will be wrapped by an element.
50 * For example,
51 *
52 * <pre>
53 * @XmlRootElement
54 * class Foo {
55 * @XmlElement
56 * List<String> data;
57 * }
58 * </pre>
59 *
60 * would produce XML like this:
75 * @XmlElement
76 * @XmlList
77 * List<String> data;
78 * }
79 * </pre>
80 *
81 * the above code will produce XML like this:
82 *
83 * <pre>{@code
84 * <foo>
85 * <data>abc def</data>
86 * </foo>
87 * }</pre>
88 *
89 * <p>This annotation can be used with the following annotations:
90 * {@link XmlElement},
91 * {@link XmlAttribute},
92 * {@link XmlValue},
93 * {@link XmlIDREF}.
94 * <ul>
95 * <li> The use of <tt>@XmlList</tt> with {@link XmlValue} while
96 * allowed, is redundant since {@link XmlList} maps a
97 * collection type to a simple schema type that derives by
98 * list just as {@link XmlValue} would. </li>
99 *
100 * <li> The use of <tt>@XmlList</tt> with {@link XmlAttribute} while
101 * allowed, is redundant since {@link XmlList} maps a
102 * collection type to a simple schema type that derives by
103 * list just as {@link XmlAttribute} would. </li>
104 * </ul>
105 *
106 * @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul>
107 * @since 1.6, JAXB 2.0
108 */
109 @Retention(RUNTIME) @Target({FIELD,METHOD,PARAMETER})
110 public @interface XmlList {
111 }
|
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javax.xml.bind.annotation;
27
28 import java.lang.annotation.Retention;
29 import java.lang.annotation.Target;
30 import static java.lang.annotation.RetentionPolicy.RUNTIME;
31 import static java.lang.annotation.ElementType.FIELD;
32 import static java.lang.annotation.ElementType.METHOD;
33 import static java.lang.annotation.ElementType.PARAMETER;
34
35 /**
36 * Used to map a property to a list simple type.
37 *
38 * <p><b>Usage</b> </p>
39 * <p>
40 * The {@code @XmlList} annotation can be used with the
41 * following program elements:
42 * <ul>
43 * <li> JavaBean property </li>
44 * <li> field </li>
45 * </ul>
46 *
47 * <p>
48 * When a collection property is annotated just with @XmlElement,
49 * each item in the collection will be wrapped by an element.
50 * For example,
51 *
52 * <pre>
53 * @XmlRootElement
54 * class Foo {
55 * @XmlElement
56 * List<String> data;
57 * }
58 * </pre>
59 *
60 * would produce XML like this:
75 * @XmlElement
76 * @XmlList
77 * List<String> data;
78 * }
79 * </pre>
80 *
81 * the above code will produce XML like this:
82 *
83 * <pre>{@code
84 * <foo>
85 * <data>abc def</data>
86 * </foo>
87 * }</pre>
88 *
89 * <p>This annotation can be used with the following annotations:
90 * {@link XmlElement},
91 * {@link XmlAttribute},
92 * {@link XmlValue},
93 * {@link XmlIDREF}.
94 * <ul>
95 * <li> The use of {@code @XmlList} with {@link XmlValue} while
96 * allowed, is redundant since {@link XmlList} maps a
97 * collection type to a simple schema type that derives by
98 * list just as {@link XmlValue} would. </li>
99 *
100 * <li> The use of {@code @XmlList} with {@link XmlAttribute} while
101 * allowed, is redundant since {@link XmlList} maps a
102 * collection type to a simple schema type that derives by
103 * list just as {@link XmlAttribute} would. </li>
104 * </ul>
105 *
106 * @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul>
107 * @since 1.6, JAXB 2.0
108 */
109 @Retention(RUNTIME) @Target({FIELD,METHOD,PARAMETER})
110 public @interface XmlList {
111 }
|