Module eclipselink

Annotation Interface XmlWriteTransformer


@Target({METHOD,FIELD}) @Retention(RUNTIME) @Repeatable(XmlWriteTransformers.class) public @interface XmlWriteTransformer
Annotation for XMLTransformationMapping. XmlWriteTransformer defines transformation of the attribute value to a single XML value (XPath is specified in the XmlWriteTransformer).

One or more XmlWriteTransformer annotations may be specified directly on the method or attribute. Multiple occurrences of XmlWriteTransformer annotation can be wrapped into XmlWriteTransformers annotation. No XmlWriteTransformers specified for read-only mapping. Unless the XMLTransformationMapping is write-only, it should have a XmlReadTransformer defining transformation of XML value(s) into attribute value.

See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Specify here the XPath into which the value should be written.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The mapped class must have a method with this name which returns a value to be written into the XML document.
    User-defined class that must implement the FieldTransformer interface.
  • Element Details

    • transformerClass

      Class<?> transformerClass
      User-defined class that must implement the FieldTransformer interface. The class will be instantiated, its FieldTransformer.buildFieldValue(Object, String, org.eclipse.persistence.sessions.Session) will be used to create the value to be written into XML document.

      Either transformerClass or method() must be specified, but not both.

      Default:
      void.class
    • method

      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:
      ""
    • xmlPath

      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 XmlWriteTransformer annotates an attribute - the attribute's name will be used as an element name.