Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be 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"

Line 24: Line 24:
 
| align="center" | X
 
| align="center" | X
 
|}
 
|}
 +
 +
== Example: Class-level XmlInlineBinaryData Annotation ==
 +
 +
=== Java Metadata  ===
 +
 +
The following example will demonstrate how the [http://java.sun.com/javase/6/docs/api/javax/xml/bind/annotation/XmlInlineBinaryData.html XmlInlineBinaryData] annotation can be applied at the class level:
 +
 +
==== org.example.MyDate.java  ====
 +
 +
<source lang="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; }
 +
}
 +
</source>
 +
 +
=== 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.
 +
 +
<source lang="xml">
 +
<?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>
 +
</source>

Revision as of 07:08, 15 January 2010

Phase 9 - Attachments (part 2; page under construction)

Provide support for WebService attachments.

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.MyDate.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.

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>

Back to the top