The list of methods to do Method from Class are organized into topic(s).
Method
findMethod(Class javaClass, String methodName, Class[] methodParameterTypes) Finding a method within a class potentially has to navigate through it's superclasses to eventually find the method.
try {
return javaClass.getDeclaredMethod(methodName, methodParameterTypes);
} catch (NoSuchMethodException ex) {
Class superclass = javaClass.getSuperclass();
if (superclass == null) {
throw ex;
} else {
try {
...
Method
findMethod(Class> c, String name, Class> params[]) find Method
Method methods[] = findMethods(c);
if (methods == null)
return null;
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().equals(name)) {
Class<?> methodParams[] = methods[i].getParameterTypes();
if (methodParams == null)
if (params == null || params.length == 0)
...
Method
findMethod(Method m, Class> c) find Method
String name = m.getName();
Class<?> params[] = new Class<?>[0];
try {
return c.getMethod(name, params);
} catch (Throwable th) {
return null;
Method[]
findMethods(Class> c) find Methods
Method methods[] = (Method[]) objectMethods.get(c);
if (methods != null)
return methods;
methods = c.getMethods();
objectMethods.put(c, methods);
return methods;
Set
getAllMethodsWithAnnotation(String packageName, Class extends Annotation> annotation)
get All Methods With Annotation
Set<Method> methods = new HashSet<Method>();
try {
for (Class<?> cls : getClasses(packageName)) {
for (Method method : cls.getMethods()) {
if (hasAnnotation(method, annotation)) {
methods.add(method);
} catch (SecurityException e) {
System.err.println("ClassUtil.getAllMethods: " + e.getMessage());
} catch (IOException e) {
System.err.println("ClassUtil.getAllMethods: " + e.getMessage());
return methods;
Method
getMethod(Class> type, Method m) get Method
if (m == null || Modifier.isPublic(type.getModifiers())) {
return m;
Class<?>[] inf = type.getInterfaces();
Method mp = null;
for (int i = 0; i < inf.length; i++) {
try {
mp = inf[i].getMethod(m.getName(), m.getParameterTypes());
...