flex.messaging.util
Class MethodMatcher

java.lang.Object
  extended by flex.messaging.util.MethodMatcher

public class MethodMatcher
extends Object

A utility class used to find a suitable method based on matching signatures to the types of set of arguments. Since the arguments may be from more loosely typed environments such as ActionScript, a translator can be employed to handle type conversion. Note that there isn't a great guarantee for which method will be selected when several overloaded methods match very closely through the use of various combinations of generic types.


Nested Class Summary
static class MethodMatcher.Match
          A utiltiy class to help rank methods in the search for a best match, given a name and collection of input parameters.
 
Constructor Summary
MethodMatcher()
           
 
Method Summary
static void convertParams(List parameters, Class[] desiredParamTypes, MethodMatcher.Match currentMatch)
          Utility method to convert a collection of parameters to desired types.
 Method getMethod(Class c, String methodName, List parameters)
          Utility method that searches a class for a given method, taking into account the supplied parameters when evaluating overloaded method signatures.
static void methodNotFound(String methodName, Class[] suppliedParamTypes, MethodMatcher.Match bestMatch)
          Utility method to provide more detailed information in the event that a search for a specific method failed for the service class.
static Class[] paramTypes(List parameters)
          Utility method that iterates over a collection of input parameters to determine their types while logging the class names to create a unique identifier for a method signature.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodMatcher

public MethodMatcher()
Method Detail

getMethod

public Method getMethod(Class c,
                        String methodName,
                        List parameters)
Utility method that searches a class for a given method, taking into account the supplied parameters when evaluating overloaded method signatures.

Parameters:
c - the class
methodName - desired method to search for
parameters - required to distinguish between overloaded methods of the same name
Returns:
The best-match Method.

convertParams

public static void convertParams(List parameters,
                                 Class[] desiredParamTypes,
                                 MethodMatcher.Match currentMatch)
Utility method to convert a collection of parameters to desired types. We keep track of the progress of the conversion to allow callers to gauge the sucess of the conversion. This is important for ranking overloaded-methods and debugging purposes.

Parameters:
parameters -
desiredParamTypes -
currentMatch -

paramTypes

public static Class[] paramTypes(List parameters)
Utility method that iterates over a collection of input parameters to determine their types while logging the class names to create a unique identifier for a method signature.

Parameters:
parameters - - A list of supplied parameters.
Returns:
An array of Class instances indicating the class of each corresponding parameter.

methodNotFound

public static void methodNotFound(String methodName,
                                  Class[] suppliedParamTypes,
                                  MethodMatcher.Match bestMatch)
Utility method to provide more detailed information in the event that a search for a specific method failed for the service class.

Parameters:
methodName - the name of the missing method
suppliedParamTypes - the types of parameters supplied for the search
bestMatch - the best match found during the search


Copyright © 2008 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/util/MethodMatcher.html