public final class ReflectionUtils extends Object
| Modifier and Type | Field and Description | 
|---|---|
static Predicate<Method> | 
NOT_PRIVATE  | 
static Method | 
OBJECT_EQUALS  | 
static Method | 
OBJECT_FINALIZE  | 
static Method | 
OBJECT_HASHCODE  | 
static Method | 
OBJECT_TOSTRING  | 
| Modifier and Type | Method and Description | 
|---|---|
static Method | 
findMethod(Class<?> clazz,
          String name,
          Predicate<Method> filter)
Attempt to find a  
Method on the supplied class with the supplied
 name and no parameters. | 
static Method | 
findMethod(Class<?> clazz,
          String name,
          Predicate<Method> filter,
          Class<?>... paramTypes)
Attempt to find a  
Method on the supplied class with the supplied
 name and parameter types. | 
static <T> Constructor<T> | 
getConstructor(Class<T> clazz,
              Object... objs)
Returns a constructor that contains  
objs as arguments. | 
static Method | 
getDeclaredMethod(Class<?> clazz,
                 String name,
                 Class<?>... paramTypes)
Basically calls getDeclaredMethod on a Class but wraps the
 NoSuchMethodException into a Runtime. 
 | 
static Set<Method> | 
getDefaultMethods(Class<?> clazz)
Return all default methods of an interface and it's inherited interface. 
 | 
static boolean | 
isClassAvailable(String className)
Tells if a class is available in the classpath 
 | 
public static final Method OBJECT_EQUALS
public static final Method OBJECT_HASHCODE
public static final Method OBJECT_TOSTRING
public static final Method OBJECT_FINALIZE
public static Method findMethod(Class<?> clazz, String name, Predicate<Method> filter)
Method on the supplied class with the supplied
 name and no parameters. Searches all superclasses up to
 Object. The filter is used to ignore some kind of methods the caller doesn't want to see returned. In this case
 they are totally ignored and can't clash with a non-ignored one to cause ambiguity.
 
 Returns null if no Method can be found.
clazz - the class to introspectname - the name of the methodfilter - tells what methods to ignore in the researchnull if none foundpublic static Method findMethod(Class<?> clazz, String name, Predicate<Method> filter, Class<?>... paramTypes)
Method on the supplied class with the supplied
 name and parameter types. Searches all superclasses up to
 Object. The filter is used to ignore some kind of methods the caller doesn't want to see returned. In this case
 they are totally ignored and can't clash with a non-ignored one to cause ambiguity.
 
 Returns null if no Method can be found.
clazz - the class to introspectname - the name of the methodfilter - tells what methods to ignore in the researchparamTypes - the parameter types of the method (may be null to
            indicate any signature)null if none foundpublic static <T> Constructor<T> getConstructor(Class<T> clazz, Object... objs) throws NoSuchMethodException
objs as arguments.
 
 We could not do something like clazz.getConstructor(objs.class())
 because that would require casting all the passed arguments to the exact
 parameter types of the desired constructor.
T - type of the class searchedclazz - class on which we are searching the constructorobjs - list of arguments of the constructorobjsNoSuchMethodException - when the constructor with args does not exist or is
             ambiguouspublic static Method getDeclaredMethod(Class<?> clazz, String name, Class<?>... paramTypes)
clazz - class on which the getDeclaredMethod is calledname - method nameparamTypes - method parameterspublic static boolean isClassAvailable(String className)
className - full class nameCopyright © 2001–2022 EasyMock contributors. All rights reserved.