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 classStackTrace.StackFrameA 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 BigDecimalensureBigDecimal(Number num)Ensure the specified Number is a BigDecimal value or convert it into a new BigDecimal object.static StackTrace.StackFramegetCallerStackFrame()Get the StackFrame information for the caller of the current method.static StringgetDeepMessage(Throwable t, String sDelim)Extract a throwable's message, and all causal messages.static StringgetExpression(String sMethod)Get the source code expression from the method that called the specified method.static StackTrace.StackFramegetStackFrame()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 StringgetStackTrace()Build a stack trace for the current thread.static StringgetStackTrace(Thread t)Print stack trace for running thread.static StringgetStackTrace(Throwable e)Build a stack trace for the passed exception that does not include the exception description itself.static StringprintStackTrace(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
-
-