com.espertech.esper.util
Class MethodResolver

java.lang.Object
  extended by com.espertech.esper.util.MethodResolver

public class MethodResolver
extends java.lang.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 Summary
MethodResolver()
           
 
Method Summary
static java.util.Map<java.lang.Class,java.util.Set<java.lang.Class>> getWideningConversions()
          Returns the allowable widening conversions.
static java.lang.reflect.Constructor resolveCtor(java.lang.Class declaringClass, java.lang.Class[] paramTypes)
           
static java.lang.reflect.Method resolveMethod(java.lang.Class declaringClass, java.lang.String methodName, java.lang.Class[] 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodResolver

public MethodResolver()
Method Detail

getWideningConversions

public static java.util.Map<java.lang.Class,java.util.Set<java.lang.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 java.lang.reflect.Method resolveMethod(java.lang.Class declaringClass,
                                                     java.lang.String methodName,
                                                     java.lang.Class[] paramTypes,
                                                     boolean allowInstance,
                                                     boolean[] allowEventBeanType,
                                                     boolean[] allowEventBeanCollType)
                                              throws EngineNoSuchMethodException
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
Returns:
- the Method object for this method
Throws:
EngineNoSuchMethodException - if the method could not be found

resolveCtor

public static java.lang.reflect.Constructor resolveCtor(java.lang.Class declaringClass,
                                                        java.lang.Class[] paramTypes)
                                                 throws EngineNoSuchCtorException
Throws:
EngineNoSuchCtorException

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com