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.
Difference between revisions of "EclipseLink/DesignDocs/293925/Phase9"
< EclipseLink | DesignDocs | 293925
Line 38: | Line 38: | ||
| align="center" | X | | align="center" | X | ||
|} | |} | ||
+ | |||
+ | == Example: XmlMimeType annotation == | ||
+ | |||
+ | === Java Metadata === | ||
+ | |||
+ | The following example will demonstrate how the [http://java.sun.com/javase/6/docs/api/javax/xml/bind/annotation/XmlMimeType.html XmlMimeType] annotation can be applied: | ||
+ | |||
+ | ==== org.example.AttTypes.java ==== | ||
+ | |||
+ | <source lang="java"> | ||
+ | package org.example; | ||
+ | |||
+ | @javax.xml.bind.annotation.XmlRootElement(name="att-types") | ||
+ | public class AttTypes { | ||
+ | @javax.xml.bind.annotation.XmlMimeType("text/plain") | ||
+ | public byte[] b; | ||
+ | @javax.xml.bind.annotation.XmlMimeType("application/binary") | ||
+ | public DataHandler d; | ||
+ | @javax.xml.bind.annotation.XmlMimeType("text/xml") | ||
+ | public Source s; | ||
+ | @javax.xml.bind.annotation.XmlMimeType("image/jpeg") | ||
+ | public Image i; | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | === XML Metadata === | ||
+ | |||
+ | ==== xml-mime-type ==== | ||
+ | |||
+ | If this is present in the XML then it completely replaces the corresponding annotation. | ||
+ | |||
+ | ==== org/example/eclipselink-oxm.xml ==== | ||
+ | |||
+ | This XML file represents metadata overrides for the "org.example.AttTypes" class. | ||
+ | |||
+ | <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.AttTypes"> | ||
+ | <java-attributes> | ||
+ | <xml-element java-attribute="b" xml-mime-type="text/plain" /> | ||
+ | <xml-element java-attribute="d" xml-mime-type="application/binary" /> | ||
+ | <xml-element java-attribute="s" xml-mime-type="text/xml" /> | ||
+ | <xml-element java-attribute="i" xml-mime-type="image/jpeg" /> | ||
+ | </java-attributes> | ||
+ | </java-type> | ||
+ | </java-types> | ||
+ | </xml-bindings> | ||
+ | </source> |
Revision as of 15:11, 18 November 2009
Phase 9 - Attachments (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 |
---|---|---|---|---|---|
XmlAttachmentRef | xml-attachment-ref | X | X | ||
XmlMimeType | xml-mime-type | X | X | ||
XmlInlineBinaryData | xml-inline-binary-data | X | X | X |
Example: XmlMimeType annotation
Java Metadata
The following example will demonstrate how the XmlMimeType annotation can be applied:
org.example.AttTypes.java
package org.example; @javax.xml.bind.annotation.XmlRootElement(name="att-types") public class AttTypes { @javax.xml.bind.annotation.XmlMimeType("text/plain") public byte[] b; @javax.xml.bind.annotation.XmlMimeType("application/binary") public DataHandler d; @javax.xml.bind.annotation.XmlMimeType("text/xml") public Source s; @javax.xml.bind.annotation.XmlMimeType("image/jpeg") public Image i; }
XML Metadata
xml-mime-type
If this is present in the XML then it completely replaces the corresponding annotation.
org/example/eclipselink-oxm.xml
This XML file represents metadata overrides for the "org.example.AttTypes" class.
<?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.AttTypes"> <java-attributes> <xml-element java-attribute="b" xml-mime-type="text/plain" /> <xml-element java-attribute="d" xml-mime-type="application/binary" /> <xml-element java-attribute="s" xml-mime-type="text/xml" /> <xml-element java-attribute="i" xml-mime-type="image/jpeg" /> </java-attributes> </java-type> </java-types> </xml-bindings>