Class StackTraces
- java.lang.Object
-
- org.opendaylight.infrautils.utils.StackTraces
-
public final class StackTraces extends Object
Utilities forStackTraceElement
& Co.- Author:
- Michael Vorburger.ch, based on an idea by Stephen Kitt
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getCallerMethodName(int depth)
Obtain the name of the method that is depth N way up the call stack from invoking this.static String
getCallersCallerMethodName()
Obtain the name of the method that is the method calling this one.
-
-
-
Method Detail
-
getCallersCallerMethodName
public static String getCallersCallerMethodName()
Obtain the name of the method that is the method calling this one. This is just a short cut forgetCallerMethodName(2)
, and is typically what one wants when using this from another utility.- Returns:
- name of calling Java method
-
getCallerMethodName
public static String getCallerMethodName(int depth)
Obtain the name of the method that is depth N way up the call stack from invoking this. So e.g. depth 0 is the name of the method calling this; but is rarely what one wants - as that is already known at that point. Typically depth 1 or 2 is what one intends.- Parameters:
depth
- depth into call stack- Returns:
- name of calling Java method
-
-