Module eclipselink

Class MethodBasedFieldTransformer

  • All Implemented Interfaces:
    Serializable, CoreFieldTransformer<Session>, FieldTransformer

    public class MethodBasedFieldTransformer
    extends 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
    • Constructor Detail

      • MethodBasedFieldTransformer

        public MethodBasedFieldTransformer​(String methodName)
    • 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 interface FieldTransformer
        Parameters:
        mapping - - the mapping this transformer is associated with.
      • getFieldType

        public Class<?> getFieldType()
        Return the Java class type of the field value. This uses the method return type.
      • buildFieldValue

        public Object buildFieldValue​(Object object,
                                      String fieldName,
                                      Session session)
        Specified by:
        buildFieldValue in interface CoreFieldTransformer<Session>
        Specified by:
        buildFieldValue in interface FieldTransformer
        Parameters:
        object - - an instance of the domain class which contains the attribute
        fieldName - - 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 String getMethodName()
      • setMethodName

        public void setMethodName​(String name)