Java Reflection Method Name getMethodCount(Class clazz, String methodName)

Here you can find the source of getMethodCount(Class clazz, String methodName)

Description

get Method Count

License

Open Source License

Declaration

public static int getMethodCount(Class<?> clazz, String methodName) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.lang.reflect.Method;

public class Main {
    public static int getMethodCount(Class<?> clazz, String methodName) {
        int count = 0;
        do {//  w ww  . j  a va 2s . c  o m
            for (int i = 0; i < clazz.getDeclaredMethods().length; i++) {
                Method method = clazz.getDeclaredMethods()[i];
                if (methodName.equals(method.getName())) {
                    count++;
                }
            }
            clazz = clazz.getSuperclass();
        } while (clazz != null);
        return count;
    }
}

Related

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