Interface MethodExecutor

All Known Implementing Classes:
ReflectiveMethodExecutor
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface MethodExecutor
A MethodExecutor is built by a MethodResolver and can be cached by the infrastructure to repeat an operation quickly without going back to the resolvers.

For example, the particular method to execute on an object may be discovered by a MethodResolver which then builds a MethodExecutor that executes that method, and the resolved MethodExecutor can be reused without needing to go back to the resolvers to discover the method again.

If a MethodExecutor becomes stale, it should throw an AccessException which signals to the infrastructure to go back to the resolvers to ask for a new one.

Since:
3.0
Author:
Andy Clement, Sam Brannen
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    execute(EvaluationContext context, Object target, Object... arguments)
    Execute a method in the specified context using the specified arguments.
  • Method Details

    • execute

      TypedValue execute(EvaluationContext context, Object target, Object... arguments) throws AccessException
      Execute a method in the specified context using the specified arguments.
      Parameters:
      context - the evaluation context in which the method is being executed
      target - the target of the method invocation; may be null for static methods
      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 MethodExecutor has become stale