Java Reflection Method Name getMethod(String methodName, Class[] paramTypes, Class targetClass)

Here you can find the source of getMethod(String methodName, Class[] paramTypes, Class targetClass)

Description

get Method

License

Apache License

Declaration

public static Method getMethod(String methodName, Class<?>[] paramTypes, Class<?> targetClass) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.lang.reflect.Method;

public class Main {

    public static Method getMethod(String methodName, Class<?>[] paramTypes, Class<?> targetClass) {
        try {/*w  w  w .  ja  v a2s. c o m*/
            return targetClass.getDeclaredMethod(methodName, paramTypes);
        } catch (Exception e) {
            Class<?> superClass = targetClass.getSuperclass();
            if (superClass == null || superClass.equals(Object.class)) {
                return null;
            }
            return getMethod(methodName, paramTypes, superClass);
        }
    }
}

Related

  1. getMethod(String className, String methodName, Class[] params)
  2. getMethod(String methodName, Class clazz)
  3. getMethod(String methodName, Class clazz, Class... args)
  4. getMethod(String methodName, Class klass)
  5. getMethod(String methodName, Class type)
  6. getMethod(String methodName, Class[] params)
  7. getMethod(String methodName, Method method, boolean fromComponentType)
  8. getMethod(String name, Class pojoClass)
  9. getMethod(String name, Method method)