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

EclipseLink/DesignDocs/317962/Phase2.1

< EclipseLink‎ | DesignDocs‎ | 317962
Revision as of 14:17, 26 July 2010 by Unnamed Poltroon (Talk) (Xml Metadata Tags)

Phase 2.1 - Additional MOXy external metadata support

This phase of development involves providing additional MOXy external metadata support that allows similar configuration abilities as with deployment XML

Xml Metadata Tags

The following Xml metadata tags will be targeted in this phase:

XML Metadata Tag MOXy Annotation Package Type Field Method
xml-class-extractor XmlClassExtractor   X    
xml-property XmlProperty   X X X
xml-transformation XmlTransformation     X X
xml-read-transformer XmlReadTransformer     X X
xml-write-transformer XmlWriteTransformer     X X

xml-class-extractor

Example

The following example will demonstrate how the xml-class-extractor can be applied.

Setting xml-class-extractor via EclipseLink XML metadata can be accomplished as follows:

<java-type name="org.example.Employee">
    <xml-class-extractor class="org.example.MyClassExtractor" />
</java-type>

xml-property

Example: type-level xml-property

The following example will demonstrate how a type-level xml-property can be applied.

Setting xml-property on a type via EclipseLink XML metadata can be accomplished as follows:

<java-type name="org.example.Employee">
    <xml-property name="identifier" value="101" value-type="Integer.class" />
    <xml-property name="isTrue" value="false" value-type="Boolean.class" />
</java-type>

Example: property-level xml-property

The following example will demonstrate how a property-level xml-property can be applied.

Setting xml-property on a field/method via EclipseLink XML metadata can be accomplished as follows:

<java-type name="org.example.Employee">
    <java-attributes>
        <xml-element java-attribute="myelement">
            <xml-property name="isAttribute" value="false" value-type="Boolean.class" />
            <xml-property name="comment" value="this is an element" value-type="String.class" />
        </xml-element>
    </java-attributes>
</java-type>

xml-transformation

Following is the proposed schema structure for xml-transform:

<xs:complexType name="xml-transformation">
  <xs:sequence>
    <xs:element name="xml-read-transformer" type="xml-read-transformer"/>
    <xs:element name="xml-write-transformer" type="xml-write-transformer" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="xml-access-type" type="xml-access-type" minOccurs="0"/>
    <xs:element name="xml-property" type="xml-property" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="xml-access-methods" type="xml-access-methods" minOccurs="0"/>
  </xs:sequence>
  <xs:attribute name="name" type="xs:string" use="required"/>
  <xs:attribute name="fetch" type="orm:fetch-type"/>
  <xs:attribute name="optional" type="xs:boolean"/>
  <xs:attribute name="access" type="orm:access-type"/>
  <xs:attribute name="mutable" type="xs:boolean"/>
  <xs:attribute name="attribute-type" type="xs:string"/>
</xs:complexType>

Example

The following example will demonstrate how the xml-transformation can be applied.

Setting xml-transformation via EclipseLink XML metadata can be accomplished as follows:

<java-type name="org.example.Employee">
    <java-attributes>
        <xml-element java-attribute="myelement">
            <xml-transformation>
            </xml-transformation>
        </xml-element>
    </java-attributes>
</java-type>

xml-read-transformer

Following is the proposed schema structure for xml-read-transformer:

<xs:complexType name="xml-read-transformer">
  <xs:attribute name="transformer-class" type="xs:string"/>
  <xs:attribute name="method" type="xs:string"/>
</xs:complexType>

Example

The following example will demonstrate how the xml-read-transformer can be applied.

Setting xml-read-transformer via EclipseLink XML metadata can be accomplished as follows:

<java-type name="org.example.Employee">
    <java-attributes>
        <xml-element java-attribute="myelement" write-only="true">
            <xml-read-transformer />
        </xml-element>
    </java-attributes>
</java-type>

xml-write-transformer

Following is the proposed schema structure for xml-write-transformer:

<xs:complexType name="xml-write-transformer">
  <xs:sequence>
    <xs:element name="column" type="orm:column"/>
  </xs:sequence>
  <xs:attribute name="transformer-class" type="xs:string"/>
  <xs:attribute name="method" type="xs:string"/>
</xs:complexType>

Example

The following example will demonstrate how the xml-write-transformer can be applied.

Setting xml-read-transformer via EclipseLink XML metadata can be accomplished as follows:

<java-type name="org.example.Employee">
    <java-attributes>
        <xml-element java-attribute="myelement" read-only="true">
            <xml-write-transformer />
        </xml-element>
    </java-attributes>
</java-type>

Back to the top