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.
Difference between revisions of "EclipseLink/DesignDocs/317962/Phase1"
< EclipseLink | DesignDocs | 317962
(→Annotations) |
(→Example: ??? annotation) |
||
Line 81: | Line 81: | ||
|} | |} | ||
− | == Example: | + | == Example: XmlReadOnly annotation == |
=== Java Metadata === | === Java Metadata === | ||
− | The following example will demonstrate how the | + | The following example will demonstrate how the XmlReadOnly annotation can be applied: |
− | ==== | + | A property can be configured to be read-only via XML metadata as follows: |
+ | ==== eclipselink-oxm.xml ==== | ||
+ | <source lang="xml"> | ||
+ | <xml-attribute java-attribute="salary" read-only="true" /> | ||
+ | </source> | ||
+ | The equivalent configured via annotations would look like: | ||
+ | ==== org.example.Employee.java ==== | ||
<source lang="java"> | <source lang="java"> | ||
package org.example; | package org.example; | ||
− | |||
− | + | public class Employee { | |
− | + | @javax.xml.bind.annotation.XmlAttribute | |
− | + | @org.eclipse.persistence.oxm.annotations.XmlReadOnly | |
− | + | public String salary; | |
− | + | } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</source> | </source> |
Revision as of 10:54, 25 June 2010
Phase 1 - Provide MOXy annotation support equivalent to our XML metadata support
This phase of development involves providing MOXy annotation support equivalent to the existing EclipseLink XML metadata support
Annotations
The following annotations will be targeted in this phase:
Annotation | XML Metadata Tag | Package | Type | Field | Method |
---|---|---|---|---|---|
XmlReadOnly | read-only | X | X | ||
XmlWriteOnly | write-only | X | X | ||
XmlCDATA | cdata | X | X | ||
XmlAccessMethods | xml-access-methods | X | X | ||
XmlPaths | xml-elements | X | X | ||
XmlNullPolicy | xml-null-policy | X | X | ||
XmlIsSetNullPolicy | xml-is-set-null-policy | X | X | ||
XmlIsSetParameters | n/a | X | X | ||
XmlIsSetParameter | is-set-parameter | X | X |
Example: XmlReadOnly annotation
Java Metadata
The following example will demonstrate how the XmlReadOnly annotation can be applied:
A property can be configured to be read-only via XML metadata as follows:
eclipselink-oxm.xml
<xml-attribute java-attribute="salary" read-only="true" />
The equivalent configured via annotations would look like:
org.example.Employee.java
package org.example; public class Employee { @javax.xml.bind.annotation.XmlAttribute @org.eclipse.persistence.oxm.annotations.XmlReadOnly public String salary; }