Java Reflection Method Name getMethod(Class clazz, String name, Class... args)

Here you can find the source of getMethod(Class clazz, String name, Class... args)

Description

get Method

License

Open Source License

Declaration

public static Method getMethod(Class clazz, String name, Class<?>... args) 

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 name, Class<?>... args) {
        Method method = null;//from   w ww  .j a  va  2 s .c  o m
        try {
            method = clazz.getMethod(name, args);
        } catch (NoSuchMethodException e) {
            try {
                method = clazz.getDeclaredMethod(name, args);
            } catch (NoSuchMethodException e2) {

            }
        }
        return method;
    }
}

Related

  1. getMethod(Class clazz, String methodName)
  2. getMethod(Class clazz, String methodName, Class argType)
  3. getMethod(Class clazz, String methodName, Class[] classes)
  4. getMethod(Class clazz, String methodName, Class[] params)
  5. getMethod(Class clazz, String name)
  6. getMethod(Class cls, String methodName, Class[] params)
  7. getMethod(Class clz, String methodName, Class expectedTypes[])
  8. getMethod(Class klazz, String[] methodNames, int argCount)
  9. getMethod(Class objClass, String methodName, Class argClass)