Java Reflection Method Name getMethod(Class clazz, String methodName, Class... params)

Here you can find the source of getMethod(Class clazz, String methodName, Class... params)

Description

get Method

License

Open Source License

Declaration

public static Method getMethod(Class<?> clazz, String methodName, Class<?>... params)
            throws NoSuchMethodException 

Method Source Code


//package com.java2s;

import java.lang.reflect.Method;

public class Main {
    public static Method getMethod(Class<?> clazz, String methodName, Class<?>... params)
            throws NoSuchMethodException {
        try {/*from   w w w .ja  v  a  2  s.com*/
            return clazz.getDeclaredMethod(methodName, params);
        } catch (NoSuchMethodException e) {
            Class<?> superClass = clazz.getSuperclass();
            if (superClass == null) {
                throw e;
            } else {
                return getMethod(superClass, methodName, params);
            }
        }
    }
}

Related

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