|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.util.StackTrace
Provides access to the current stack trace by parsing the output of
Throwable.printStackTrace()
.
Nested Class Summary | |
static class |
StackTrace.Entry
A stack trace entry. |
static class |
StackTrace.Parser
A parser which takes a standard Throwable and produces StackTrace.Entry objects. |
Field Summary | |
protected List |
stack
List of StackTrace.Entry elements |
static int |
UNLIMITED
Parse all entries |
Constructor Summary | |
|
StackTrace()
Construct a StackTrace. |
|
StackTrace(int level)
Construct a StackTrace. |
|
StackTrace(int level,
int limit)
Construct a StackTrace. |
protected |
StackTrace(List stack)
Sub-trace constructor. |
|
StackTrace(Throwable detail)
Initialize a StackTrace. |
|
StackTrace(Throwable detail,
int level)
Initialize a StackTrace. |
|
StackTrace(Throwable detail,
int level,
int limit)
Initialize a StackTrace. |
Method Summary | |
static StackTrace.Entry |
callerEntry()
Returns a stack trace entry for the calling methods current position in the stack. |
Object |
clone()
Returns a shallow cloned copy of this object. |
static StackTrace.Entry |
currentEntry()
Returns a stack trace entry for the current position in the stack. |
boolean |
equals(Object obj)
Check if the given object is equals to this. |
StackTrace.Entry |
getCallerEntry()
Returns the stack trace entry for the calling method. |
StackTrace |
getCallerTrace()
Returns the stack trace starting at the calling method. |
StackTrace.Entry |
getEntry(int level)
Returns the stack trace entry for the element at the given level. |
StackTrace.Entry |
getRootEntry()
Return the root entry for this stack trace. |
StackTrace |
getSubTrace(int level)
Returns a sub trace starting at the the given level. |
StackTrace |
getSubTrace(int level,
int limit)
Returns a sub trace starting at the the given level. |
Iterator |
iterator()
Returns an iterator over all of the entries in the stack trace. |
void |
print()
Print this stack trace to System.err . |
void |
print(PrintStream stream)
Print this stack trace. |
void |
print(PrintStream stream,
String prefix)
Print this stack trace. |
void |
print(PrintWriter writer)
Print this stack trace. |
void |
print(PrintWriter writer,
String prefix)
Print this stack trace. |
void |
print(String prefix)
Print this stack trace to System.err . |
static StackTrace.Entry |
rootEntry()
Returns a stack trace entry for the root calling method of the current execution thread. |
int |
size()
Returns the number of entries (or size) of the stack trace. |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int UNLIMITED
protected final List stack
Constructor Detail |
public StackTrace(Throwable detail, int level, int limit)
detail
- Detail throwable to determine stack entries from.level
- Number of levels to go down into the trace.limit
- The maximum number of entries to parse (does not
include skipped levels or the description).
A value <= zero results in all entries being parsed.
IllegalArgumentException
- Invalid level or limit.
NestedRuntimeException
- Failed to create Parser.
NestedRuntimeException
- Failed to parse stack trace.public StackTrace(Throwable detail, int level)
detail
- Detail throwable to determine stack entries from.level
- Number of levels to go down into the trace.
IllegalArgumentException
- Invalid level.
NestedRuntimeException
- Failed to create Parser.
NestedRuntimeException
- Failed to parse stack trace.public StackTrace(Throwable detail)
detail
- Detail throwable to determine stack entries from.
NestedRuntimeException
- Failed to create Parser.
NestedRuntimeException
- Failed to parse stack trace.public StackTrace(int level, int limit)
level
- Number of levels to go down into the trace.limit
- The maximum number of entries to parse (does not
include skipped levels or the description).
A value <= zero results in all entries being parsed.public StackTrace(int level)
level
- Number of levels to go down into the trace.public StackTrace()
protected StackTrace(List stack)
Method Detail |
public boolean equals(Object obj)
obj
- Object to test equality with.
public Object clone()
public StackTrace.Entry getEntry(int level)
level
- Number of levels.
IndexOutOfBoundsException
- Invalid level index.public StackTrace.Entry getCallerEntry()
public StackTrace.Entry getRootEntry()
public StackTrace getSubTrace(int level)
level
- Number of levels.
public StackTrace getSubTrace(int level, int limit)
level
- Number of levels.limit
- Limit the sub-trace. If there are less entries
than the limit, the limit has no effect.
public StackTrace getCallerTrace()
public void print(PrintWriter writer, String prefix)
writer
- The writer to print to.prefix
- Stack trace entry prefix.public void print(PrintWriter writer)
writer
- The writer to print to.public void print(PrintStream stream, String prefix)
stream
- The stream to print to.prefix
- Stack trace entry prefix.public void print(PrintStream stream)
stream
- The stream to print to.public void print(String prefix)
System.err
.
prefix
- Stack trace entry prefix.public void print()
System.err
.
public Iterator iterator()
public int size()
public static final StackTrace.Entry currentEntry()
The current entry refers to the method that has invoked
currentEntry()
.
public static final StackTrace.Entry callerEntry()
Calling method in this case refers to the method that has called
the method which invoked callerEntry()
.
IndexOutOfBoundsException
- The current entry is at bottom
of the stack.public static final StackTrace.Entry rootEntry()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |