Oracle TopLink Developer's Guide
10g Release 3 (10.1.3) B13593-01 |
|
![]() Previous |
![]() Next |
A transformation mapping is made up of an attribute transformer for field-to-attribute transformation at read (unmarshall) time and one or more field transformers for attribute-to-field transformation at write (marshall) time (see "Configuring Field Transformer Associations").
This section describes how to configure the attribute transformer that a transformation mapping uses to perform the field-to-attribute transformation at read (unmarshal) time.
You can do this using either a method or class-based transformer.
A method-based transformer must map to a method in the domain object.
A class-based transformer allows you to place the transformation code in another class, making this approach non-intrusive: that is, your domain object does not need to implement a TopLink interface or provide a special transformation method
Table 35-16 summarizes which mappings support this option.
To specify a mapping's attribute transformer, use this procedure:
Click Edit. The Specify Transformer dialog box appears. Use the following information to enter data in each field of the dialog box and click OK:
Field | Description |
---|---|
Use Transformation Method | Select a specific method to control the transformation. A method based transformer must map to a method in the domain object. |
Use Transformer Class | Select a specific class to control the transformation. The class must be available on the TopLink Workbench application classpath. |
You can configure a method-based attribute transformer using AbstractTransformationMapping
method setAttributeTransformation
, passing in the name of the domain object method to use.
You can configure a class-based attribute transformer using AbstractTransformationMapping
method setAttributeTransformer
, passing in an instance of oracle.toplink.mappings.Transfomers.AttributeTransformer
.
A convenient way to create an AttributeTransformer
is to extend AttributeTransformerAdapter
.