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

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

Description

get Method

License

Open Source License

Declaration

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

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) {
        try {//from  w  w  w .  ja  v  a 2  s.  c o  m
            Method m = clazz.getMethod(name);
            if (m != null)
                return m;
        } catch (Exception e) {
        }
        for (Method m : clazz.getMethods())
            if (m.getName().equalsIgnoreCase(name))
                return m;
        return null;
    }
}

Related

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