Package com.oracle.coherence.common.base
Class StackTrace
- java.lang.Object
-
- com.oracle.coherence.common.base.StackTrace
-
public abstract class StackTrace extends Object
Class for providing StackTrace functionality.- Since:
- 20.06
- Author:
- cp 2000.08.02
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StackTrace.StackFrame
A class that provides "stack frame" information from a line of a stack trace.
-
Constructor Summary
Constructors Constructor Description StackTrace()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BigDecimal
ensureBigDecimal(Number num)
Ensure the specified Number is a BigDecimal value or convert it into a new BigDecimal object.static StackTrace.StackFrame
getCallerStackFrame()
Get the StackFrame information for the caller of the current method.static String
getDeepMessage(Throwable t, String sDelim)
Extract a throwable's message, and all causal messages.static String
getExpression(String sMethod)
Get the source code expression from the method that called the specified method.static StackTrace.StackFrame
getStackFrame()
Get the StackFrame information for the current method.static StackTrace.StackFrame[]
getStackFrames()
Iterate the StackFrame information for all callers, going from the inside outwards, and starting with the caller of this method.static String
getStackTrace()
Build a stack trace for the current thread.static String
getStackTrace(Thread t)
Print stack trace for running thread.static String
getStackTrace(Throwable e)
Build a stack trace for the passed exception that does not include the exception description itself.static String
printStackTrace(Throwable e)
Build a stack trace for the passed exception.
-
-
-
Method Detail
-
getCallerStackFrame
public static StackTrace.StackFrame getCallerStackFrame()
Get the StackFrame information for the caller of the current method.- Returns:
- the StackFrame information for the caller of the current method
-
getStackFrame
public static StackTrace.StackFrame getStackFrame()
Get the StackFrame information for the current method.- Returns:
- the StackFrame information for the current method
-
getStackFrames
public static StackTrace.StackFrame[] getStackFrames()
Iterate the StackFrame information for all callers, going from the inside outwards, and starting with the caller of this method.- Returns:
- an Iterator of StackFrames
-
getStackTrace
public static String getStackTrace()
Build a stack trace for the current thread.- Returns:
- a String containing a printable stack trace
-
getStackTrace
public static String getStackTrace(Throwable e)
Build a stack trace for the passed exception that does not include the exception description itself.- Parameters:
e
- a Throwable object that contains stack trace information- Returns:
- a String containing a printable stack trace
-
getDeepMessage
public static String getDeepMessage(Throwable t, String sDelim)
Extract a throwable's message, and all causal messages.- Parameters:
t
- the throwablesDelim
- the delimiter to include between messages- Returns:
- the concatenated messages
-
printStackTrace
public static String printStackTrace(Throwable e)
Build a stack trace for the passed exception.- Parameters:
e
- a Throwable object that contains stack trace information- Returns:
- a String containing a printable stack trace
-
ensureBigDecimal
public static BigDecimal ensureBigDecimal(Number num)
Ensure the specified Number is a BigDecimal value or convert it into a new BigDecimal object.- Parameters:
num
- a Number object- Returns:
- a BigDecimal object that is equal to the passed in Number
-
getExpression
public static String getExpression(String sMethod)
Get the source code expression from the method that called the specified method.- Parameters:
sMethod
- the first method on the stack after the method whose source code is desired- Returns:
- null on any failure, otherwise the expression
-
-