
public final class ReflectionUtils extends Object
| Modifier | Constructor and Description |
|---|---|
private |
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Constructor<T> |
bestConstructor(Class<T> clazz,
Class<?>[] argClass)
Searches the best method in a class, given its name and arguments.
|
private static <T extends Executable> |
bestExecutable(T[] candidates,
Class<?>[] argClass) |
static Method |
bestMethod(Class<?> clazz,
String methodName,
Class<?>[] argClass)
Searches the best method in a class, given its name and arguments.
|
static Object |
invokeMethod(Method method,
Object target,
Object[] args)
This method tries to invoke the passed method.
|
public static Method bestMethod(Class<?> clazz, String methodName, Class<?>[] argClass)
clazz - the classmethodName - the method nameargClass - the arguments for the methodpublic static <T> Constructor<T> bestConstructor(Class<T> clazz, Class<?>[] argClass)
T - the typeclazz - the classargClass - the arguments for the methodprivate static <T extends Executable> T bestExecutable(T[] candidates, Class<?>[] argClass)
public static Object invokeMethod(Method method, Object target, Object[] args)
method - the methods to invoketarget - the target object. It can be null, if the method which is
being invoked is staticargs - the arguments for the methodIllegalStateException
if something goes wrong.