78 lines
3.9 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="header">
<div class="subTitle">
javax.xml.bind.annotation
</div>
<h2 class="title" title="Annotation Type XmlSeeAlso">Annotation Type XmlSeeAlso</h2>
</div><div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr/> <br/> <pre><a href="../../../../java/lang/annotation/Target.html" title="annotation in java.lang.annotation">@Target</a>(<a href="../../../../java/lang/annotation/Target.html#value--">value</a>=<a href="../../../../java/lang/annotation/ElementType.html#TYPE">TYPE</a>)
<a href="../../../../java/lang/annotation/Retention.html" title="annotation in java.lang.annotation">@Retention</a>(<a href="../../../../java/lang/annotation/Retention.html#value--">value</a>=<a href="../../../../java/lang/annotation/RetentionPolicy.html#RUNTIME">RUNTIME</a>)
public @interface <span class="memberNameLabel">XmlSeeAlso</span></pre>
<div class="block">
<span>指示JAXB在绑定此类时也绑定其他类。</span>
<p> <span>Java使列表给定类的所有子类变得不切实际/不可能。</span> <span>这通常会让JAXB用户受益因为JAXB无法自动列出<code>JAXBContext</code>需要知道的<a href="../../../../javax/xml/bind/JAXBContext.html" title="javax.xml.bind中的类"></a></span> </p>
<p> <span>例如,使用以下类定义:</span> </p>
<pre> <span>class Animal {}
class Dog extends Animal {}
class Cat extends Animal {}</span> </pre>
<p> <span>用户将需要创建<a href="../../../../javax/xml/bind/JAXBContext.html" title="javax.xml.bind中的类"><code>JAXBContext</code></a><tt>JAXBContext.newInstance(Dog.class,Cat.class)</tt> <tt>Animal</tt>将自动从<tt>Dog</tt><tt>Cat</tt>引用)。</span> </p>
<p> <span><a href="../../../../javax/xml/bind/annotation/XmlSeeAlso.html" title="javax.xml.bind.annotation中的注释"><code>XmlSeeAlso</code></a>注释将允许你写:</span> </p>
<pre> <span>@XmlSeeAlso({Dog.class,Cat.class})
class Animal {}
class Dog extends Animal {}
class Cat extends Animal {}</span> </pre>
<p> <span>这将允许你做<tt>JAXBContext.newInstance(Animal.class)</tt></span> <span>在这个注释的帮助下JAXB实现将能够正确地绑定<tt>Dog</tt><tt>Cat</tt></span> </p>
</div>
<dl>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
JAXB2.1
</dd>
</dl> </li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.required.element.summary">
<!-- --> </a> <h3>Required Element Summary</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Required Element Summary table, listing required elements, and an explanation">
<caption>
<span>Required Elements</span>
<span class="tabEnd"> </span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Required Element and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../java/lang/Class.html" title="class in java.lang"></a>[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/xml/bind/annotation/XmlSeeAlso.html#value--">value</a></span></code> </td>
</tr>
</tbody>
</table> </li>
</ul> </li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.element.detail">
<!-- --> </a> <h3>Element Detail</h3> <a name="value--">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>value</h4> <pre>public abstract <a href="../../../../java/lang/Class.html" title="class in java.lang"></a>[] value</pre> </li>
</ul> </li>
</ul> </li>
</ul>
</div>
</div>