-
Notifications
You must be signed in to change notification settings - Fork 41
/
XmlAttachmentRef.java
63 lines (58 loc) · 1.9 KB
/
XmlAttachmentRef.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* Copyright (c) 2005, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package jakarta.xml.bind.annotation;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import jakarta.activation.DataHandler;
/**
* Marks a field/property that its XML form is a URI reference to mime content.
* The mime content is optimally stored out-of-line as an attachment.
* <p>
* A field/property must always map to the {@link DataHandler} class.
*
* <h2>Usage</h2>
* {@snippet :
* @XmlRootElement
* class Foo {
* @XmlAttachmentRef
* @XmlAttribute
* DataHandler data;
*
* @XmlAttachmentRef
* @XmlElement
* DataHandler body;
* }
* }
* The above code maps to the following XML:
* {@snippet lang="XML" :
* <xs:element name="foo" xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd">
* <xs:complexType>
* <xs:sequence>
* <xs:element name="body" type="ref:swaRef" minOccurs="0" />
* </xs:sequence>
* <xs:attribute name="data" type="ref:swaRef" use="optional" />
* </xs:complexType>
* </xs:element>
* }
*
* <p>
* The above binding supports WS-I AP 1.0 <a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0.html#Referencing_Attachments_from_the_SOAP_Envelope">WS-I Attachments Profile Version 1.0.</a>
*
* @author Kohsuke Kawaguchi
* @since 1.6, JAXB 2.0
*/
@Retention(RUNTIME)
@Target({FIELD,METHOD,PARAMETER})
public @interface XmlAttachmentRef {
}