Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
|
![]() Previous |
![]() Next |
You can use an XML transformation mapping to create a custom mapping where one or more XML nodes can be used to create the object to be stored in a Java class's attribute. To handle the custom requirements at marshall (write) and unmarshall (read) time, a transformation mapping takes instances of oracle.toplink.mappings.transformers
(such as AttributeTransformer
and FieldTransformer
) that you provide. This provides a nonintrusive solution that avoids the need for your domain objects to implement special interfaces for this purpose.
As Figure 65-34 illustrates, you configure the transformation mapping with an oracle.toplink.mappings.transformers.AttributeTransformer
instance to perform the XML instance-to-Java attribute transformation at unmarshall time. In this example, the AttributeTransformer
combines two XML text nodes into a single Java object.
Similarly, you also configure the transformation mapping with one or more oracle.toplink.mappings.transformers.FieldTransformer
instances to perform the Java attribute-to-XML instance transformation at marshall time. In this example, each FieldTransformer
is responsible for mapping one of the Java object values to an XML text node.
See Chapter 73, "Configuring an XML Transformation Mapping" for more information.