@Target(value=TYPE) @Retention(value=RUNTIME) public @interface XmlSeeAlso
Java使列表给定类的所有子类变得不切实际/不可能。 这通常会让JAXB用户受益,因为JAXB无法自动列出JAXBContext
需要知道的类 。
例如,使用以下类定义:
class Animal {}
class Dog extends Animal {}
class Cat extends Animal {}
用户将需要创建JAXBContext
为JAXBContext.newInstance(Dog.class,Cat.class) ( Animal将自动从Dog和Cat引用)。
XmlSeeAlso
注释将允许你写:
@XmlSeeAlso({Dog.class,Cat.class})
class Animal {}
class Dog extends Animal {}
class Cat extends Animal {}
这将允许你做JAXBContext.newInstance(Animal.class) 。 在这个注释的帮助下,JAXB实现将能够正确地绑定Dog和Cat 。
public abstract 类[] value
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, 2014, Oracle and/or its affiliates. All rights reserved.