1/*
2 * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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
26package javax.xml.bind.annotation;
27
28import javax.xml.bind.JAXBContext;
29import java.lang.annotation.ElementType;
30import java.lang.annotation.Retention;
31import static java.lang.annotation.RetentionPolicy.RUNTIME;
32import java.lang.annotation.Target;
33
34/**
35 * Instructs JAXB to also bind other classes when binding this class.
36 *
37 * <p>
38 * Java makes it impractical/impossible to list all sub-classes of
39 * a given class. This often gets in a way of JAXB users, as it JAXB
40 * cannot automatically list up the classes that need to be known
41 * to {@link JAXBContext}.
42 *
43 * <p>
44 * For example, with the following class definitions:
45 *
46 * <pre>
47 * class Animal {}
48 * class Dog extends Animal {}
49 * class Cat extends Animal {}
50 * </pre>
51 *
52 * <p>
53 * The user would be required to create {@link JAXBContext} as
54 * {@code JAXBContext.newInstance(Dog.class,Cat.class)}
55 * ({@code Animal} will be automatically picked up since {@code Dog}
56 * and {@code Cat} refers to it.)
57 *
58 * <p>
59 * {@link XmlSeeAlso} annotation would allow you to write:
60 * <pre>
61 * &#64;XmlSeeAlso({Dog.class,Cat.class})
62 * class Animal {}
63 * class Dog extends Animal {}
64 * class Cat extends Animal {}
65 * </pre>
66 *
67 * <p>
68 * This would allow you to do {@code JAXBContext.newInstance(Animal.class)}.
69 * By the help of this annotation, JAXB implementations will be able to
70 * correctly bind {@code Dog} and {@code Cat}.
71 *
72 * @author Kohsuke Kawaguchi
73 * @since 1.6, JAXB 2.1
74 */
75@Target({ElementType.TYPE})
76@Retention(RUNTIME)
77public @interface XmlSeeAlso {
78    Class[] value();
79}
80