public class StackTraceUtil extends Object
StackTraceElement
corresponding to a
calling method in the caller stack.Modifier and Type | Method and Description |
---|---|
static StackTraceElement |
getCurrentMethodStackTraceElement()
Returns the stack trace element corresponding to the direct caller
method, that is, the method which calls this method.
|
static StackTraceElement |
getCurrentMethodStackTraceElement(int callerOffset)
Returns the stack trace element belonging to the
callerOffsetth caller of the calling method. |
public static StackTraceElement getCurrentMethodStackTraceElement()
public static StackTraceElement getCurrentMethodStackTraceElement(int callerOffset)
callerOffsetth
caller of the calling method.
For example, callerOffset=0
returns the stack trace element of
the direct caller of this method; callerOffset=1
corresponds to
the method calling the direct caller method, etc.
callerOffset
- the index of the stack trace element in the caller stack,
where callerOffset=0
corresponds to the direct caller
of this methodCopyright © 2024. All rights reserved.