Class MethodAttributeAccessor

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, CoreAttributeAccessor
    Direct Known Subclasses:
    VirtualAttributeAccessor

    public class MethodAttributeAccessor
    extends AttributeAccessor

    Purpose: A wrapper class for handling cases when the domain object attributes are to be accessed thru the accessor methods. This could happen if the variables are not defined public in the domain object.

    Since:
    TOPLink/Java 1.0
    Author:
    Sati
    See Also:
    Serialized Form
    • Field Detail

      • setMethodName

        protected java.lang.String setMethodName
      • getMethodName

        protected java.lang.String getMethodName
      • setMethod

        protected transient java.lang.reflect.Method setMethod
      • getMethod

        protected transient java.lang.reflect.Method getMethod
    • Constructor Detail

      • MethodAttributeAccessor

        public MethodAttributeAccessor()
    • Method Detail

      • getAttributeValueFromObject

        protected java.lang.Object getAttributeValueFromObject​(java.lang.Object anObject,
                                                               java.lang.Object[] parameters)
                                                        throws DescriptorException
        Gets the value of an instance variable in the object.
        Throws:
        DescriptorException
      • getGetMethod

        public java.lang.reflect.Method getGetMethod()
        Return the accessor method for the attribute accessor. 266912: For Metamodel API - change visibility from protected
      • getGetMethodName

        public java.lang.String getGetMethodName()
        Return the name of the accessor method for the attribute accessor.
      • getGetMethodReturnType

        public java.lang.Class getGetMethodReturnType()
                                               throws DescriptorException
        INTERNAL: Return the GetMethod return type for this MethodAttributeAccessor. A special check is made to determine if a missing method is a result of failed weaving.
        Returns:
        Throws:
        DescriptorException
      • getSetMethod

        protected java.lang.reflect.Method getSetMethod()
        Return the set method for the attribute accessor.
      • getSetMethodName

        public java.lang.String getSetMethodName()
        Return the name of the set method for the attribute accessor.
      • getSetMethodParameterType

        public java.lang.Class getSetMethodParameterType()
      • getSetMethodParameterType

        protected java.lang.Class getSetMethodParameterType​(int index)
      • getSetMethodParameterTypes

        protected java.lang.Class[] getSetMethodParameterTypes()
      • initializeAttributes

        protected void initializeAttributes​(java.lang.Class theJavaClass,
                                            java.lang.Class[] getParameterTypes)
                                     throws DescriptorException
        Set get and set method after creating these methods by using get and set method names
        Throws:
        DescriptorException
      • isInitialized

        public boolean isInitialized()
        Returns true if this attribute accessor has been initialized and now stores a reference to the class's attribute. An attribute accessor can become uninitialized on serialization.
        Overrides:
        isInitialized in class AttributeAccessor
      • setAttributeValueInObject

        protected void setAttributeValueInObject​(java.lang.Object domainObject,
                                                 java.lang.Object attributeValue,
                                                 java.lang.Object[] parameters)
                                          throws DescriptorException
        Sets the value of the instance variable in the object to the value.
        Throws:
        DescriptorException
      • setGetMethod

        protected void setGetMethod​(java.lang.reflect.Method getMethod)
        Set the accessor method for the attribute accessor.
      • setGetMethodName

        public void setGetMethodName​(java.lang.String getMethodName)
        Set the name of the accessor method for the attribute accessor.
      • setSetMethod

        protected void setSetMethod​(java.lang.reflect.Method setMethod)
        Set the set method for the attribute accessor.
      • setSetMethodName

        public void setSetMethodName​(java.lang.String setMethodName)
        Set the name of the set method for the attribute accessor.