@Target(value=TYPE) @Retention(value=RUNTIME) public @interface XmlSeeAlso
java是不切实际或不可能列出一个给定类的所有子类。这往往会在某种程度上它JAXB JAXB用户不能自动列出需要知道JAXBContext
类。
例如,用下面的类定义:
类动物{ }类狗扩展动物{ }类猫扩展动物{ }
用户将需要创建JAXBContext
作为JAXBContext.newInstance(Dog.class,Cat.class)(Animal会自动拿起自Dog和Cat指它。)
XmlSeeAlso
注释允许你写:
@ XmlSeeAlso({狗。类,猫类})类动物{ }类狗扩展动物{ }类猫扩展动物{ }
这将允许你做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.