Class MethodResolver
java.lang.Object
com.espertech.esper.common.internal.util.MethodResolver
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the allowable widening conversions.static Constructor
resolveCtor
(Class declaringClass, EPType[] paramTypes) static Method
resolveMethod
(Class declaringClass, String methodName, EPType[] paramTypes, boolean allowInstance, boolean[] allowEventBeanType, boolean[] allowEventBeanCollType) 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.static CodegenExpression
static Method
resolveMethodExactNonStatic
(Class declaringClass, String methodName, Class[] parameters) NOTE: Code-generation-invoked method, method name and parameter order matters
-
Constructor Details
-
MethodResolver
public MethodResolver()
-
-
Method Details
-
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 methodmethodName
- - the name of the methodparamTypes
- - the parameter types for the methodallowInstance
- - true to allow instance methods as well, false to allow only static methodallowEventBeanCollType
- whether event-bean-collection parameter type is allowedallowEventBeanType
- 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 -
resolveMethodCodegenExactNonStatic
-
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 classmethodName
- method nameparameters
- parameters- Returns:
- method
-