Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/DesignDocs/293925/Phase9"

(Phase 9 - Attachments (part 2; page under construction))
(Phase 9 - Attachments)
Line 2: Line 2:
 
= Phase 9 - Attachments =
 
= Phase 9 - Attachments =
  
Provide support for WebService attachments.  
+
Provide support for WebService attachments.  Note that information pertaining to [http://java.sun.com/javase/6/docs/api/javax/xml/bind/annotation/XmlAttachmentRef.html XmlAttachmentRef] and [http://java.sun.com/javase/6/docs/api/javax/xml/bind/annotation/XmlMimeType.html XmlMimeType] support can be found [http://wiki.eclipse.org/EclipseLink/DesignDocs/277920/Phase5.1 here].
  
 
== Annotations  ==
 
== Annotations  ==

Revision as of 07:43, 15 January 2010

Phase 9 - Attachments

Provide support for WebService attachments. Note that information pertaining to XmlAttachmentRef and XmlMimeType support can be found here.

Annotations

The following annotations will be targetted in this phase:

Annotation XML Metadata Tag Package Type Field Method
XmlInlineBinaryData xml-inline-binary-data   X X X

Example: Class-level XmlInlineBinaryData Annotation

Java Metadata

The following example will demonstrate how the XmlInlineBinaryData annotation can be applied at the class level:

org.example.MyData.java

package org.example;
 
@javax.xml.bind.annotation.XmlInlineBinaryData
@javax.xml.bind.annotation.XmlRootElement(name="my-data")
public class MyData {
    private DataHandler myDataHandler;
 
    public byte[] bytes;
    public DataHandler getData() { return myDataHandler; }
    public void setData(DataHandler data) { myDataHandler = data; }
}

XML Metadata

xml-inline-binary-data

If this is present in XML, the corresponding annotation will be ignored, and the true/false value set in XML used instead. Note that an @XmlInlineBinaryData annotated property will not be overridden by a class-level xml-inline-binary-data declaration in XML.

org/example/eclipselink-oxm.xml

This XML file represents metadata overrides for the "org.example" package.

<?xml version="1.0" encoding="US-ASCII"?>
<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
    <java-types>
        <java-type name="org.example.MyData" xml-inline-binary-data="true">
            <xml-root-element name="my-data"/>
        </java-type>
    </java-types>
</xml-bindings>

Example: Property-level XmlInlineBinaryData Annotation

Java Metadata

The following example will demonstrate how the XmlInlineBinaryData annotation can be applied at the property level:

org.example.MyData.java

package org.example;
 
@javax.xml.bind.annotation.XmlRootElement(name="my-data")
public class MyData {
    private DataHandler myDataHandler;
 
    @javax.xml.bind.annotation.XmlInlineBinaryData
    public byte[] bytes;
 
    @javax.xml.bind.annotation.XmlInlineBinaryData
    public DataHandler getData() { return myDataHandler; }
    public void setData(DataHandler data) { myDataHandler = data; }
}

XML Metadata

xml-inline-binary-data

If this is present in XML, the corresponding annotation will be ignored, and the true/false value set in XML used instead.

org/example/eclipselink-oxm.xml

This XML file represents metadata overrides for the "org.example" package.

<?xml version="1.0" encoding="US-ASCII"?>
<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
    <java-types>
        <java-type name="org.example.MyData">
            <xml-root-element name="my-data"/>
            <java-attributes>
                <xml-element java-attribute="bytes" xml-inline-binary-data="true" />
                <xml-element java-attribute="data"  xml-inline-binary-data="true" />
            </java-attributes>
        </java-type>
    </java-types>
</xml-bindings>

Back to the top