public final class StackTrace extends Object
The GNU Lesser General Public License for details.
Modifier and Type | Class and Description |
---|---|
class |
StackTrace.AbstractStackIterator<T>
Base class for the real enumeration implementations below
|
Modifier and Type | Field and Description |
---|---|
private String[] |
classNames
Array containing the class names
|
private String[] |
fileNames
Array containing the file names
|
private int[] |
lineNumbers
Array containing the line numbers
|
private String[] |
methodNames
Array containing the method names
|
Constructor and Description |
---|
StackTrace()
Generate a stack trace an model it
|
StackTrace(Throwable ex)
We already have an Exception that we'd like to model
|
Modifier and Type | Method and Description |
---|---|
int |
countStackElements()
How many stack elements are there?
|
Class<?> |
getClass(int level)
Get the Class that owns the function
|
int |
getClassCount()
Get the count of classes
|
String |
getClassName(int level)
Get the name of a class
|
Iterator<String> |
getClassNameElements()
To iterate over the class names
|
String |
getFileName(int level)
Get the name of a file
|
String |
getFullFunctionName(int level)
Get the name of a function including class name
|
Iterator<String> |
getFullFunctionNameElements()
To iterate over the full function names
|
String |
getFunctionName(int level)
Get the name of a function
|
Iterator<String> |
getFunctionNameElements()
To iterate over the function names
|
int |
getLineNumber(int level)
Get the line number within a file
|
private void |
init(Throwable exception,
int discard)
Create a stack trace of the code at this point
|
private String[] classNames
private String[] methodNames
private String[] fileNames
private int[] lineNumbers
public StackTrace()
public StackTrace(Throwable ex)
ex
- The Exception to modelprivate void init(Throwable exception, int discard)
exception
- The Throwable containing the Stack Tracediscard
- The number of uppermost stack frames to ignorepublic int countStackElements()
public String getFunctionName(int level)
level
- Number of calling functionpublic String getFullFunctionName(int level)
level
- Number of calling functionpublic String getClassName(int level)
level
- Number of calling functionpublic String getFileName(int level)
level
- Number of calling functionpublic int getLineNumber(int level)
level
- Number of calling functionpublic int getClassCount()
public Class<?> getClass(int level)
level
- Number of calling functionpublic Iterator<String> getClassNameElements()
public Iterator<String> getFunctionNameElements()