uTools-Manuals/docs/java/javax/xml/bind/annotation/XmlAttachmentRef.html

49 lines
3.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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 XmlAttachmentRef">Annotation Type XmlAttachmentRef</h2>
</div><div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr/> <br/> <pre><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>)
<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#FIELD">字段</a>,<a href="../../../../java/lang/annotation/ElementType.html#METHOD">METHOD</a>,<a href="../../../../java/lang/annotation/ElementType.html#PARAMETER">PARAMETER</a>})
public @interface <span class="memberNameLabel">XmlAttachmentRef</span></pre>
<div class="block">
<span>标记一个字段/属性它的XML表单是一个uri引用mime内容。</span>
<span>mime内容被最佳地作为附件存储在行外。</span>
<span>字段/属性必须始终映射到<a href="../../../../javax/activation/DataHandler.html" title="javax.activation中的类"><code>DataHandler</code></a>类。</span>
<h2> <span>用法</span> </h2>
<pre> <span>@<a href="../../../../javax/xml/bind/annotation/XmlRootElement.html" title="annotation in javax.xml.bind.annotation"><code>XmlRootElement</code></a>
class Foo {
@<a href="../../../../javax/xml/bind/annotation/XmlAttachmentRef.html" title="annotation in javax.xml.bind.annotation"><code>XmlAttachmentRef</code></a>
@<a href="../../../../javax/xml/bind/annotation/XmlAttribute.html" title="annotation in javax.xml.bind.annotation"><code>XmlAttribute</code></a>
<a href="../../../../javax/activation/DataHandler.html" title="class in javax.activation"><code>DataHandler</code></a> data;
@<a href="../../../../javax/xml/bind/annotation/XmlAttachmentRef.html" title="annotation in javax.xml.bind.annotation"><code>XmlAttachmentRef</code></a>
@<a href="../../../../javax/xml/bind/annotation/XmlElement.html" title="annotation in javax.xml.bind.annotation"><code>XmlElement</code></a>
<a href="../../../../javax/activation/DataHandler.html" title="class in javax.activation"><code>DataHandler</code></a> body;
}</span> </pre>
<span>以上代码映射到以下XML</span>
<pre> <span>&lt;xs:element name="foo" xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd"&gt;
&lt;xs:complexType&gt;
&lt;xs:sequence&gt;
&lt;xs:element name="body" type="ref:swaRef" minOccurs="0" /&gt;
&lt;/xs:sequence&gt;
&lt;xs:attribute name="data" type="ref:swaRef" use="optional" /&gt;
&lt;/xs:complexType&gt;
&lt;/xs:element&gt;</span> </pre>
<p> <span>上述绑定支持WS-I AP 1.0 <a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html#Referencing_Attachments_from_the_SOAP_Envelope">WS-I Attachments Profile Version 1.0.</a></span> </p>
</div>
<dl>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
JAXB2.0
</dd>
</dl> </li>
</ul>
</div>
</div>