Class ReflectiveMethodExecutor
java.lang.Object
org.springframework.expression.spel.support.ReflectiveMethodExecutor
- All Implemented Interfaces:
- MethodExecutor
MethodExecutor that works via reflection.- Since:
- 3.0
- Author:
- Andy Clement, Juergen Hoeller
- 
Constructor SummaryConstructorsConstructorDescriptionReflectiveMethodExecutor(Method method) Create a new executor for the given method.ReflectiveMethodExecutor(Method method, Class<?> targetClass) Create a new executor for the given method.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanexecute(EvaluationContext context, Object target, Object... arguments) Execute a method in the specified context using the specified arguments.final MethodReturn the original method that this executor has been configured for.Class<?>Find the first public class in the method's declaring class hierarchy that declares this method.
- 
Constructor Details- 
ReflectiveMethodExecutorCreate a new executor for the given method.- Parameters:
- method- the method to invoke
 
- 
ReflectiveMethodExecutorCreate a new executor for the given method.- Parameters:
- method- the method to invoke
- targetClass- the target class to invoke the method on
- Since:
- 5.3.16
 
 
- 
- 
Method Details- 
getMethodReturn the original method that this executor has been configured for.
- 
getPublicDeclaringClassFind the first public class in the method's declaring class hierarchy that declares this method.Sometimes the reflective method discovery logic finds a suitable method that can easily be called via reflection but cannot be called from generated code when compiling the expression because of visibility restrictions. For example, if a non-public class overrides toString(), this helper method will traverse up the type hierarchy to find the first public type that declares the method (if there is one). FortoString(), it may traverse as far as Object.
- 
didArgumentConversionOccurpublic boolean didArgumentConversionOccur()
- 
executepublic TypedValue execute(EvaluationContext context, Object target, Object... arguments) throws AccessException Description copied from interface:MethodExecutorExecute a method in the specified context using the specified arguments.- Specified by:
- executein interface- MethodExecutor
- Parameters:
- context- the evaluation context in which the method is being executed
- target- the target of the method invocation; may be- nullfor- staticmethods
- arguments- the arguments to the method; should match (in terms of number and type) whatever the method will need to run
- Returns:
- the value returned from the method
- Throws:
- AccessException- if there is a problem executing the method or if this- MethodExecutorhas become stale
 
 
-