Package io.microsphere.util
Class StackTraceUtils
- java.lang.Object
-
- io.microsphere.util.StackTraceUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Class<?>getCallerClassInStatckTrace()Get caller class fromstack tracesstatic java.lang.Class<?>getCallerClassInStatckTrace(int invocationFrame)Get caller class in General JVMstatic java.lang.StringgetCallerClassNameInStackTrace()General implementation, get the calling class namestatic java.lang.StringgetCallerClassNameInStackTrace(int invocationFrame)General implementation, get the calling class name by specifying the calling level valuestatic java.lang.StackTraceElement[]getStackTrace()Retrieves the stack trace elements for the current thread's call stack.
-
-
-
Method Detail
-
getCallerClassInStatckTrace
public static java.lang.Class<?> getCallerClassInStatckTrace()
Get caller class fromstack traces- Returns:
- Caller Class
- See Also:
getCallerClassInStatckTrace(int)
-
getCallerClassNameInStackTrace
public static java.lang.String getCallerClassNameInStackTrace()
General implementation, get the calling class name- Returns:
- call class name
- See Also:
getCallerClassNameInStackTrace(int)
-
getCallerClassInStatckTrace
public static java.lang.Class<?> getCallerClassInStatckTrace(int invocationFrame)
Get caller class in General JVM- Parameters:
invocationFrame- invocation frame- Returns:
- caller class
- See Also:
getCallerClassNameInStackTrace(int)
-
getCallerClassNameInStackTrace
public static java.lang.String getCallerClassNameInStackTrace(int invocationFrame) throws java.lang.IndexOutOfBoundsExceptionGeneral implementation, get the calling class name by specifying the calling level value- Parameters:
invocationFrame- invocation frame- Returns:
- specified invocation frame class
- Throws:
java.lang.IndexOutOfBoundsException
-
getStackTrace
@Nonnull public static java.lang.StackTraceElement[] getStackTrace()
Retrieves the stack trace elements for the current thread's call stack.This method is useful for inspecting the sequence of method calls that led to the current point of execution. It can be used for debugging, logging, or monitoring purposes.
Example Usage
StackTraceElement[] stackTrace = StackTraceUtils.getStackTrace(); for (StackTraceElement element : stackTrace) { System.out.println(element); }- Returns:
- a non-null array of
StackTraceElementrepresenting the current thread's stack trace
-
-