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

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

Description

get Method

License

LGPL

Declaration

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

Method Source Code

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

import java.lang.reflect.Method;

public class Main {
    public static Method getMethod(Class<?> clazz, String name, boolean declared, Class<?>... args) {
        try {/*w  ww . j  a v a 2  s .co m*/
            Method method = null;

            if (declared) {
                method = clazz.getDeclaredMethod(name, args);
                method.setAccessible(true);
            } else
                method = clazz.getMethod(name, args);

            return method;
        } catch (Throwable error) {
            return null;
        }
    }
}

Related

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