Package ognl

Class ObjectMethodAccessor

  • All Implemented Interfaces:
    MethodAccessor

    public class ObjectMethodAccessor
    extends java.lang.Object
    implements MethodAccessor
    Implementation of PropertyAccessor that uses reflection on the target object's class to find a field or a pair of set/get methods with the given property name.
    Author:
    Luke Blanshard (blanshlu@netscape.net), Drew Davidson (drew@ognl.org)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object callMethod​(java.util.Map context, java.lang.Object target, java.lang.String methodName, java.lang.Object[] args)
      Calls the method named with the arguments given.
      java.lang.Object callStaticMethod​(java.util.Map context, java.lang.Class targetClass, java.lang.String methodName, java.lang.Object[] args)
      Calls the static method named with the arguments given on the class given.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ObjectMethodAccessor

        public ObjectMethodAccessor()
    • Method Detail

      • callStaticMethod

        public java.lang.Object callStaticMethod​(java.util.Map context,
                                                 java.lang.Class targetClass,
                                                 java.lang.String methodName,
                                                 java.lang.Object[] args)
                                          throws MethodFailedException
        Description copied from interface: MethodAccessor
        Calls the static method named with the arguments given on the class given.
        Specified by:
        callStaticMethod in interface MethodAccessor
        Parameters:
        context - expression context in which the method should be called
        targetClass - the object in which the method exists
        methodName - the name of the method
        args - the arguments to the method
        Returns:
        result of calling the method
        Throws:
        MethodFailedException - if there is an error calling the method
      • callMethod

        public java.lang.Object callMethod​(java.util.Map context,
                                           java.lang.Object target,
                                           java.lang.String methodName,
                                           java.lang.Object[] args)
                                    throws MethodFailedException
        Description copied from interface: MethodAccessor
        Calls the method named with the arguments given.
        Specified by:
        callMethod in interface MethodAccessor
        Parameters:
        context - expression context in which the method should be called
        target - the object in which the method exists
        methodName - the name of the method
        args - the arguments to the method
        Returns:
        result of calling the method
        Throws:
        MethodFailedException - if there is an error calling the method