Package org.apache.commons.ognl
Class ObjectMethodAccessor
- java.lang.Object
-
- org.apache.commons.ognl.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.
-
-
Constructor Summary
Constructors Constructor Description ObjectMethodAccessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
callMethod(java.util.Map<java.lang.String,java.lang.Object> 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<java.lang.String,java.lang.Object> 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.
-
-
-
Method Detail
-
callStaticMethod
public java.lang.Object callStaticMethod(java.util.Map<java.lang.String,java.lang.Object> context, java.lang.Class<?> targetClass, java.lang.String methodName, java.lang.Object[] args) throws MethodFailedException
Calls the static method named with the arguments given on the class given.- Specified by:
callStaticMethod
in interfaceMethodAccessor
- Parameters:
context
- expression context in which the method should be calledtargetClass
- the object in which the method existsmethodName
- the name of the methodargs
- the arguments to the method- Returns:
- result of calling the method
- Throws:
MethodFailedException
-
callMethod
public java.lang.Object callMethod(java.util.Map<java.lang.String,java.lang.Object> context, java.lang.Object target, java.lang.String methodName, java.lang.Object[] args) throws MethodFailedException
Calls the method named with the arguments given.- Specified by:
callMethod
in interfaceMethodAccessor
- Parameters:
context
- expression context in which the method should be calledtarget
- the object in which the method existsmethodName
- the name of the methodargs
- the arguments to the method- Returns:
- result of calling the method
- Throws:
MethodFailedException
-
-