org.omegahat.Environment.Parser.Parse
Class MethodLocator

java.lang.Object
  |
  +--org.omegahat.Environment.Parser.Parse.MethodLocator

public class MethodLocator
extends java.lang.Object

This class provides the mechanisms to determine the method in a class of a given name "most closely" matching the signature specified by the arguments provided.
It does this by looking through all the available methods in the class rather than all possible permutations of the calling signature. (See MethodCall for how the latter is implemented.) Which is better depends on the total number of methods with the same signature length as the call and the actual size of the calling signature.


Field Summary
 boolean DefaultStrictFlag
           
 
Constructor Summary
MethodLocator()
           
 
Method Summary
 boolean[] isCast(List argumentSource)
           
static java.lang.Class matchClass(java.lang.Class a, java.lang.Class b)
          Determine if the second argument is (loosely) compatible with the first/target class.
static java.lang.Class matchClass(java.lang.Class a, java.lang.Class b, boolean strict)
          Determine if the second class matches the first allowing control of whether there has to be a strict match or whether we allow scalars to be promoted to arrays or conversion between primitive types as necessary.
 java.lang.Class[] matchClasses(java.lang.Class[] src, java.lang.Class[] target)
          Convenience routine to remove the need for an evaluator
 java.lang.Class[] matchClasses(java.lang.Class[] src, java.lang.Class[] target, boolean[] isCast, Evaluator evaluator)
           
 java.lang.Class[] matchClasses(java.lang.Class[] src, java.lang.Class[] target, List argExpressions, Evaluator evaluator)
           
static java.lang.Class matchInterfaces(java.lang.Class a, java.lang.Class b)
           
 java.lang.Class[] matchMethod(java.lang.reflect.Method m, java.lang.Class[] args, boolean[] isCast, Evaluator evaluator)
           
 java.lang.reflect.Method searchMethods(java.lang.Class cl, java.lang.String name, java.lang.Object[] arguments, List argumentSource, Evaluator evaluator)
           
 java.lang.reflect.Method searchMethods(java.lang.Class cl, java.lang.String name, java.lang.Object[] arguments, List argumentSource, Evaluator evaluator, java.lang.Class trueClass)
           
 java.lang.reflect.Method searchMethods(java.lang.Object o, java.lang.String name, java.lang.Object[] arguments, List argsSource, Evaluator evaluator)
           
 java.lang.reflect.Method searchMethods(java.lang.Object o, java.lang.String name, java.lang.Object[] arguments, List argsSource, Evaluator evaluator, boolean useClass)
           
 java.lang.reflect.Method searchMethods(java.lang.String name, List argumentSource, java.lang.Class[] arg_classes, java.lang.reflect.Method[] methods, Evaluator evaluator)
           
 java.lang.Class[] toClasses(java.lang.Object[] els, List original)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DefaultStrictFlag

public boolean DefaultStrictFlag
Constructor Detail

MethodLocator

public MethodLocator()
Method Detail

searchMethods

public java.lang.reflect.Method searchMethods(java.lang.Class cl,
                                              java.lang.String name,
                                              java.lang.Object[] arguments,
                                              List argumentSource,
                                              Evaluator evaluator)
                                       throws java.lang.Exception

searchMethods

public java.lang.reflect.Method searchMethods(java.lang.Class cl,
                                              java.lang.String name,
                                              java.lang.Object[] arguments,
                                              List argumentSource,
                                              Evaluator evaluator,
                                              java.lang.Class trueClass)
                                       throws java.lang.Exception

searchMethods

public java.lang.reflect.Method searchMethods(java.lang.String name,
                                              List argumentSource,
                                              java.lang.Class[] arg_classes,
                                              java.lang.reflect.Method[] methods,
                                              Evaluator evaluator)
                                       throws java.lang.Exception

searchMethods

public java.lang.reflect.Method searchMethods(java.lang.Object o,
                                              java.lang.String name,
                                              java.lang.Object[] arguments,
                                              List argsSource,
                                              Evaluator evaluator)
                                       throws java.lang.Exception

searchMethods

public java.lang.reflect.Method searchMethods(java.lang.Object o,
                                              java.lang.String name,
                                              java.lang.Object[] arguments,
                                              List argsSource,
                                              Evaluator evaluator,
                                              boolean useClass)
                                       throws java.lang.Exception

matchMethod

public java.lang.Class[] matchMethod(java.lang.reflect.Method m,
                                     java.lang.Class[] args,
                                     boolean[] isCast,
                                     Evaluator evaluator)
                              throws java.lang.Exception

matchClasses

public java.lang.Class[] matchClasses(java.lang.Class[] src,
                                      java.lang.Class[] target,
                                      boolean[] isCast,
                                      Evaluator evaluator)

matchClasses

public java.lang.Class[] matchClasses(java.lang.Class[] src,
                                      java.lang.Class[] target,
                                      List argExpressions,
                                      Evaluator evaluator)

matchClasses

public java.lang.Class[] matchClasses(java.lang.Class[] src,
                                      java.lang.Class[] target)
Convenience routine to remove the need for an evaluator

matchClass

public static java.lang.Class matchClass(java.lang.Class a,
                                         java.lang.Class b)
Determine if the second argument is (loosely) compatible with the first/target class.
Returns:
the class/interface object which is the actual matches.

matchClass

public static java.lang.Class matchClass(java.lang.Class a,
                                         java.lang.Class b,
                                         boolean strict)
Determine if the second class matches the first allowing control of whether there has to be a strict match or whether we allow scalars to be promoted to arrays or conversion between primitive types as necessary. This is a slight extension of the semantics of isAssignablFrom()

matchInterfaces

public static java.lang.Class matchInterfaces(java.lang.Class a,
                                              java.lang.Class b)

toClasses

public java.lang.Class[] toClasses(java.lang.Object[] els,
                                   List original)

isCast

public boolean[] isCast(List argumentSource)