EclipseLink 2.2.0, build 'v20110202-r8913' API Reference

org.eclipse.persistence.oxm.annotations
Annotation Type XmlWriteTransformer


@Target(value={METHOD,FIELD})
@Retention(value=RUNTIME)
public @interface XmlWriteTransformer

Annotation for org.eclipse.persistence.mappings.oxm.XMLTransformationMapping. WriteTransformer defines transformation of the attribute value to a single XML value (XPath is specified in the WriteTransformer). A single XmlWriteTransformer may be specified directly on the method or attribute. Multiple XmlWriteTransformers should be wrapped into XmlWriteTransformers annotation. No XmlWriteTransformers specified for read-only mapping. Unless the XMLTransformationMapping is write-only, it should have a ReadTransformer, it defines transformation of XML value(s) into attribute value.

See Also:
XmlReadTransformer, XmlTransformation, XmlWriteTransformers

Required Element Summary
 java.lang.String xmlPath
          Specify here the XPath into which the value should be written.
 
Optional Element Summary
 java.lang.String method
          The mapped class must have a method with this name which returns a value to be written into the XML document.
 java.lang.Class<? extends FieldTransformer> transformerClass
          User-defined class that must implement the org.eclipse.persistence.mappings.transformers.FieldTransformer interface.
 

Element Detail

xmlPath

public abstract java.lang.String xmlPath
Specify here the XPath into which the value should be written. The only case when this could be skipped is if a single WriteTransformer annotates an attribute - the attribute's name will be used as an element name.

transformerClass

public abstract java.lang.Class<? extends FieldTransformer> transformerClass
User-defined class that must implement the org.eclipse.persistence.mappings.transformers.FieldTransformer interface. The class will be instantiated, its buildFieldValue will be used to create the value to be written into XML document. Either transformerClass or method must be specified, but not both.

Default:
org.eclipse.persistence.mappings.transformers.FieldTransformer.class

method

public abstract java.lang.String method
The mapped class must have a method with this name which returns a value to be written into the XML document. The method may require an XmlTransient annotation to avoid being mapped as an XmlElement by default. Either transformerClass or method must be specified, but not both.

Default:
""

EclipseLink 2.2.0, build 'v20110202-r8913' API Reference