Java Reflection Method Name getMethodName(final int depth)

Here you can find the source of getMethodName(final int depth)

Description

get Method Name

License

Apache License

Declaration

public static String getMethodName(final int depth) 

Method Source Code


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

import java.lang.reflect.Method;

public class Main {
    private static Method m;

    public static String getMethodName(final int depth) {
        try {/*from   www .  ja v  a2 s. c  o m*/
            StackTraceElement element = (StackTraceElement) m.invoke(new Throwable(), depth + 1);
            return element.getMethodName();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

Related

  1. getMethodIfAvailable(Class clazz, String methodName, Class... paramTypes)
  2. getMethodIncludingSuperClass(Class clazz, String methodName)
  3. getMethodInternal(Class clazz, String methodName)
  4. getMethodName()
  5. getMethodName()
  6. getMethodName(Method method)
  7. getMethodName(Method method)
  8. getMethodName(Method method)
  9. getMethodName(Method method, boolean useSegment, String segment, String value)