Class MethodBasedFieldTransformer
- java.lang.Object
-
- org.eclipse.persistence.mappings.transformers.MethodBasedFieldTransformer
-
- All Implemented Interfaces:
java.io.Serializable
,CoreFieldTransformer<Session>
,FieldTransformer
public class MethodBasedFieldTransformer extends java.lang.Object implements FieldTransformer
- Version:
- $Header: MethodBasedFieldTransformer.java 18-sep-2006.16:20:59 gyorke Exp $
- See Also:
- Serialized Form
- Author:
- mmacivor
- Since:
- 10 This class is used to preserve the old method of doing Field 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
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.reflect.Method
fieldTransformationMethod
protected AbstractTransformationMapping
mapping
protected java.lang.String
methodName
-
Fields inherited from interface org.eclipse.persistence.core.mappings.transformers.CoreFieldTransformer
BUILD_FIELD_VALUE_METHOD
-
-
Constructor Summary
Constructors Constructor Description MethodBasedFieldTransformer(java.lang.String methodName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
buildFieldValue(java.lang.Object object, java.lang.String fieldName, Session session)
java.lang.Class
getFieldType()
Return the Java class type of the field value.java.lang.String
getMethodName()
void
initialize(AbstractTransformationMapping mapping)
Initialize this transformer.void
setMethodName(java.lang.String name)
-
-
-
Field Detail
-
fieldTransformationMethod
protected transient java.lang.reflect.Method fieldTransformationMethod
-
methodName
protected java.lang.String methodName
-
mapping
protected AbstractTransformationMapping mapping
-
-
Method Detail
-
initialize
public void initialize(AbstractTransformationMapping mapping)
Description copied from interface:FieldTransformer
Initialize this transformer. Only required if the user needs some special information from the mapping in order to do the transformation- Specified by:
initialize
in interfaceFieldTransformer
- Parameters:
mapping
- - the mapping this transformer is associated with.
-
getFieldType
public java.lang.Class getFieldType()
Return the Java class type of the field value. This uses the method return type.
-
buildFieldValue
public java.lang.Object buildFieldValue(java.lang.Object object, java.lang.String fieldName, Session session)
- Specified by:
buildFieldValue
in interfaceCoreFieldTransformer<Session>
- Specified by:
buildFieldValue
in interfaceFieldTransformer
- Parameters:
object
- - an instance of the domain class which contains the attributefieldName
- - the name of the field being transformed. Used if the user wants to use this transformer for multiple fields.session
- - the current session- Returns:
- - The value to be written for the field associated with this transformer
-
getMethodName
public java.lang.String getMethodName()
-
setMethodName
public void setMethodName(java.lang.String name)
-
-