Java Reflection Method Name getMethodByNameSimple(Class clz, String methodName)

Here you can find the source of getMethodByNameSimple(Class clz, String methodName)

Description

get Method By Name Simple

License

Apache License

Declaration

public static Method getMethodByNameSimple(Class<?> clz, String methodName) 

Method Source Code


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

import java.lang.reflect.Method;

public class Main {
    public static Method getMethodByNameSimple(Class<?> clz, String methodName) {
        Method[] methods = clz.getDeclaredMethods();

        for (Method method : methods) {
            if (method.getName().equals(methodName)) {
                return method;
            }/*from   w  w w. ja  v a2 s  .c o m*/
        }

        return null;
    }
}

Related

  1. getMethodByName(Class clazz, String name)
  2. getMethodByName(Class cls, String methodName)
  3. getMethodByName(Class type, String methodName)
  4. getMethodByName(final Class cls, final String action)
  5. getMethodByNameFromArray(Method[] methods, String methodName)
  6. getMethodCount(Class clazz, String methodName)
  7. getMethodCountForName(Class clazz, String methodName)
  8. getMethodExceptionType(Class cls, String methodName, Class[] argTypes, int methodPosition, int classPosition, Class defaultType)
  9. getMethodFromClass(Class cls, String methodName, Class argClass, boolean onlyProtectedAndHigher)