org.eclipse.persistence.mappings.transformers
Class MethodBasedAttributeTransformer

java.lang.Object
  extended by org.eclipse.persistence.mappings.transformers.MethodBasedAttributeTransformer
All Implemented Interfaces:
Serializable, AttributeTransformer

public class MethodBasedAttributeTransformer
extends Object
implements AttributeTransformer

Since:
release specific (what release of product did this appear in) This class is used to preserve the old method of doing Attribute Transformations on a transformation mapping. It is used internally when the older API is used on a TransformationMapping, and handles doing invocations on the user's domain class
Version:
$Header: MethodBasedAttributeTransformer.java 18-sep-2006.14:33:54 gyorke Exp $
Author:
mmacivor
See Also:
Serialized Form

Constructor Summary
MethodBasedAttributeTransformer()
           
MethodBasedAttributeTransformer(String methodName)
           
 
Method Summary
 Object buildAttributeValue(Record record, Object object, Session session)
          INTERNAL: Build the attribute value by invoking the user's transformation method.
 Method getAttributeTransformationMethod()
           
 String getMethodName()
           
 void initialize(AbstractTransformationMapping mapping)
          INTERNAL: Initilizes the transformer.
 void setAttributeTransformationMethod(Method theMethod)
           
 void setMethodName(String name)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodBasedAttributeTransformer

public MethodBasedAttributeTransformer()

MethodBasedAttributeTransformer

public MethodBasedAttributeTransformer(String methodName)
Method Detail

getMethodName

public String getMethodName()

setMethodName

public void setMethodName(String name)

getAttributeTransformationMethod

public Method getAttributeTransformationMethod()

setAttributeTransformationMethod

public void setAttributeTransformationMethod(Method theMethod)

initialize

public void initialize(AbstractTransformationMapping mapping)
INTERNAL: Initilizes the transformer. Looks up the transformation method on the domain class using reflection. This method can have either 1 or 2 parameters.

Specified by:
initialize in interface AttributeTransformer
Parameters:
mapping - - The mapping associated with this transformer. Only used if some special information is required.

buildAttributeValue

public Object buildAttributeValue(Record record,
                                  Object object,
                                  Session session)
INTERNAL: Build the attribute value by invoking the user's transformation method.

Specified by:
buildAttributeValue in interface AttributeTransformer
Parameters:
record - - The metadata being used to build the object.
object - - The current object that the attribute is being built for.
session - - the current session
Returns:
- The attribute value to be built into the object containing this mapping.