Class MethodResolver

java.lang.Object
com.espertech.esper.common.internal.util.MethodResolver

public class MethodResolver extends Object
Used for retrieving static and instance method objects. It provides two points of added functionality over the standard java.lang.reflect mechanism of retrieving methods. First, class names can be partial, and if the class name is partial then java.lang is searched for the class. Second, invocation parameter types don't have to match the declaration parameter types exactly when the standard java conversion mechanisms (currently autoboxing and widening conversions) will make the invocation valid. Preference is given to those methods that require the fewest widening conversions.
  • Constructor Details

    • MethodResolver

      public MethodResolver()
  • Method Details

    • getWideningConversions

      public static Map<Class,Set<Class>> getWideningConversions()
      Returns the allowable widening conversions.
      Returns:
      map where key is the class that we are asking to be widened into, and a set of classes that can be widened from
    • resolveMethod

      public static Method resolveMethod(Class declaringClass, String methodName, EPType[] paramTypes, boolean allowInstance, boolean[] allowEventBeanType, boolean[] allowEventBeanCollType) throws MethodResolverNoSuchMethodException
      Attempts to find the static or instance method described by the parameters, or a method of the same name that will accept the same type of parameters.
      Parameters:
      declaringClass - - the class to search for the method
      methodName - - the name of the method
      paramTypes - - the parameter types for the method
      allowInstance - - true to allow instance methods as well, false to allow only static method
      allowEventBeanCollType - whether event-bean-collection parameter type is allowed
      allowEventBeanType - whether event-bean parameter type is allowed
      Returns:
      - the Method object for this method
      Throws:
      MethodResolverNoSuchMethodException - if the method could not be found
    • resolveCtor

      public static Constructor resolveCtor(Class declaringClass, EPType[] paramTypes) throws MethodResolverNoSuchCtorException
      Throws:
      MethodResolverNoSuchCtorException
    • resolveMethodCodegenExactNonStatic

      public static CodegenExpression resolveMethodCodegenExactNonStatic(Method method)
    • resolveMethodExactNonStatic

      public static Method resolveMethodExactNonStatic(Class declaringClass, String methodName, Class[] parameters)
      NOTE: Code-generation-invoked method, method name and parameter order matters
      Parameters:
      declaringClass - declaring class
      methodName - method name
      parameters - parameters
      Returns:
      method