org.aksw.commons.util.reflect
Class MultiMethod

java.lang.Object
  extended by org.aksw.commons.util.reflect.MultiMethod

public class MultiMethod
extends Object


Constructor Summary
MultiMethod()
           
 
Method Summary
static
<T> Method
findInvocationMethod(Class<T> clazz, Class<?> returnType, Class<?>... args)
          Find the best matching methods for the given types.
static
<T> Method
findInvocationMethod(Class<T> clazz, String name, Object... args)
          Deprecated. 
static
<T> Method
findMethodByArgs(Class<T> clazz, String name, Object... args)
           
static
<T> Method
findMethodByParams(Class<T> clazz, String name, Class<?>... typeSignature)
           
static
<T> Method
findMethodByParamsCached(Class<T> clazz, String name, List<Class<?>> typeSignature)
          Errors on lookup (such as no or multiple candidates) ar not cached in will result in new lookups.
static
<T> Map<Method,Integer[]>
findMethodCandidates(Class<T> clazz, String name, Class<?>... typeSignature)
           
static
<X> X
invoke(Object o, String name, Object... args)
           
static
<T,X> X
invokeStatic(Class<T> clazz, String name, Object... args)
          Invoke the method of an object, that matches the name and arguments best.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiMethod

public MultiMethod()
Method Detail

invokeStatic

public static <T,X> X invokeStatic(Class<T> clazz,
                                   String name,
                                   Object... args)
Invoke the method of an object, that matches the name and arguments best. TODO Add some caching mechanism

Type Parameters:
T -
Parameters:
clazz -
name -
args -
Throws:
InvocationTargetException
IllegalAccessException
IllegalArgumentException

invoke

public static <X> X invoke(Object o,
                           String name,
                           Object... args)

findMethodCandidates

public static <T> Map<Method,Integer[]> findMethodCandidates(Class<T> clazz,
                                                             String name,
                                                             Class<?>... typeSignature)

findMethodByParamsCached

public static <T> Method findMethodByParamsCached(Class<T> clazz,
                                                  String name,
                                                  List<Class<?>> typeSignature)
Errors on lookup (such as no or multiple candidates) ar not cached in will result in new lookups.

Type Parameters:
T -
Parameters:
clazz -
name -
typeSignature -
Returns:

findMethodByParams

public static <T> Method findMethodByParams(Class<T> clazz,
                                            String name,
                                            Class<?>... typeSignature)

findInvocationMethod

@Deprecated
public static <T> Method findInvocationMethod(Class<T> clazz,
                                                         String name,
                                                         Object... args)
Deprecated. 


findMethodByArgs

public static <T> Method findMethodByArgs(Class<T> clazz,
                                          String name,
                                          Object... args)

findInvocationMethod

public static <T> Method findInvocationMethod(Class<T> clazz,
                                              Class<?> returnType,
                                              Class<?>... args)
Find the best matching methods for the given types. Used for casts

Type Parameters:
T -
Parameters:
clazz -
returnType -
args -
Returns:


Copyright © 2012. All Rights Reserved.