Java Reflection Method Parameter getMethod(Class target, String methodName, Class... parameterTypes)

Here you can find the source of getMethod(Class target, String methodName, Class... parameterTypes)

Description

get Method

License

Open Source License

Declaration

public static Method getMethod(Class<?> target, String methodName, Class<?>... parameterTypes) 

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<?> target, String methodName, Class<?>... parameterTypes) {
        try {/*from  www .java2s  .  co  m*/
            Method m = target.getDeclaredMethod(methodName, parameterTypes);
            if (m != null) {
                return m;
            } else {
                return target.equals(Object.class) ? null
                        : getMethod(target.getSuperclass(), methodName, parameterTypes);
            }
        } catch (Exception e) {
            return target.equals(Object.class) ? null
                    : getMethod(target.getSuperclass(), methodName, parameterTypes);
        }
    }
}

Related

  1. getMethod(Class clz, String methodName, Class... parameterTypes)
  2. getMethod(Class declaringClass, String name, Class... parameterTypes)
  3. getMethod(Class declaringType, String methodName, Class... parameterTypes)
  4. getMethod(Class instance, String method, Class... parameters)
  5. getMethod(Class sourceClass, boolean isFindDeclaredMethod, boolean isUpwardFind, String methodName, Class... methodParameterTypes)
  6. getMethod(Class type, String name, Class... parametersType)
  7. getMethod(Class type, String name, Class... parameterTypes)
  8. getMethod(Class type, String name, Class... parameterTypes)
  9. getMethod(Class clazz, String methodName, Class[] parameterTypes)