Java Reflection Method Name getMethodByNameFromArray(Method[] methods, String methodName)

Here you can find the source of getMethodByNameFromArray(Method[] methods, String methodName)

Description

get Method By Name From Array

License

LGPL

Declaration

public static Method getMethodByNameFromArray(Method[] methods, String methodName) 

Method Source Code

//package com.java2s;
/**/*from   ww w .j a va 2s .  c  om*/
 * CC-LGPL 2.1
 * http://creativecommons.org/licenses/LGPL/2.1/
 */

import java.lang.reflect.Method;

public class Main {
    public static Method getMethodByNameFromArray(Method[] methods, String methodName) {
        Method method = null;

        if (methods != null && methods.length > 0) {
            for (Method m : methods) {
                if (methodName.equalsIgnoreCase(m.getName())) {
                    System.out.println("getMethodByNameFromArray: Found method " + methodName);
                    return m;
                }
            }
        }

        return method;
    }
}

Related

  1. getMethodByName(Class clazz, String methodName)
  2. getMethodByName(Class clazz, String name)
  3. getMethodByName(Class cls, String methodName)
  4. getMethodByName(Class type, String methodName)
  5. getMethodByName(final Class cls, final String action)
  6. getMethodByNameSimple(Class clz, String methodName)
  7. getMethodCount(Class clazz, String methodName)
  8. getMethodCountForName(Class clazz, String methodName)
  9. getMethodExceptionType(Class cls, String methodName, Class[] argTypes, int methodPosition, int classPosition, Class defaultType)