In previous sections, we iterated through the StackFrame elements and provided sample code snippets. Next, we will examine it more closely. StackFrame is an interface defined inside the StackWalker class. It defines accessors and is a converter that can be used to convert the information to StackTraceElement.
The accessors the interface defines are the following:
- getClassName() will return the binary name of the class of the method represented by StackFrame.
- getMethodName() will return the name of the method represented by StackFrame.
- getDeclaringClass() will return the class of the method represented by StackFrame. If Option.RETAIN_CLASS_REFERENCE was not used during the creation of the StackWalker instance, the method will throw UnsupportedOperationException.
- getByteCodeIndex() gets the index to the code array containing the execution point of the method represented...