Java Reflection Method Name getMethod(Class clazz, String methodName, final Class[] classes)

Here you can find the source of getMethod(Class clazz, String methodName, final Class[] classes)

Description

get Method

License

Open Source License

Declaration

public static Method getMethod(Class<?> clazz, String methodName, final Class[] classes) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.lang.reflect.Method;

public class Main {

    public static Method getMethod(Class<?> clazz, String methodName, final Class[] classes) throws Exception {
        Method method = null;//from w  w  w .j  a  va2 s.com
        try {
            method = clazz.getDeclaredMethod(methodName, classes);
        } catch (NoSuchMethodException e) {
            try {
                method = clazz.getMethod(methodName, classes);
            } catch (NoSuchMethodException ex) {
                if (clazz.getSuperclass() == null) {
                    return method;
                } else {
                    method = getMethod(clazz.getSuperclass(), methodName, classes);
                }
            }
        }
        return method;
    }
}

Related

  1. getMethod(Class clazz, String methodName, Class... arguments)
  2. getMethod(Class clazz, String methodName, Class... params)
  3. getMethod(Class clazz, String methodName, Class... params)
  4. getMethod(Class clazz, String methodName, Class... params)
  5. getMethod(Class clazz, String methodName, Class... params)
  6. getMethod(Class clazz, String methodName, int numParams)
  7. getMethod(Class clazz, String name)
  8. getMethod(Class clazz, String name)
  9. getMethod(Class clazz, String name)