java.lang.Object
java.lang.StackTraceElement
- All Implemented Interfaces:
Serializable
StackTraceElement represents a stack frame.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionStackTraceElement
(String cls, String method, String file, int line) Create a StackTraceElement from the parameters.StackTraceElement
(String classLoaderName, String module, String version, String cls, String method, String file, int line) Create a StackTraceElement from the parameters. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the specified object is another StackTraceElement instance representing the same execution point as this instance.Returns the name of the ClassLoader used to load the class for the method in the stack frame.Returns the full name (i.e. including package) of the class where this stack trace element is executing.If available, returns the name of the file containing the Java code source which was compiled into the class where this stack trace element is executing.int
Returns the source file line number for the class where this stack trace element is executing.Returns the name of the method where this stack trace element is executing.Answers the name of the module to which the execution point represented by this stack trace element belongs.Answers the version of the module to which the execution point represented by this stack trace element belongs.int
hashCode()
Returns a hash code value for this stack trace element.boolean
Returnstrue
if the method name returned bygetMethodName()
is implemented as a native method.toString()
Returns a string representation of this stack trace element.
-
Constructor Details
-
StackTraceElement
Create a StackTraceElement from the parameters.- Parameters:
cls
- The class namemethod
- The method namefile
- The file nameline
- The line number
-
StackTraceElement
public StackTraceElement(String classLoaderName, String module, String version, String cls, String method, String file, int line) Create a StackTraceElement from the parameters.- Parameters:
classLoaderName
- The name for the ClassLoadermodule
- The module nameversion
- The module versioncls
- The class namemethod
- The method namefile
- The file nameline
- The line number- Since:
- 9
-
-
Method Details
-
getClassLoaderName
Returns the name of the ClassLoader used to load the class for the method in the stack frame. See ClassLoader.getName().- Returns:
- name of the Classloader or null
- Since:
- 9
-
equals
Returns true if the specified object is another StackTraceElement instance representing the same execution point as this instance. -
getModuleName
Answers the name of the module to which the execution point represented by this stack trace element belongs.- Returns:
- the name of the Module or null if it is not available
-
getModuleVersion
Answers the version of the module to which the execution point represented by this stack trace element belongs.- Returns:
- the version of the Module or null if it is not available.
-
getClassName
Returns the full name (i.e. including package) of the class where this stack trace element is executing.- Returns:
- the name of the class where this stack trace element is executing.
-
getFileName
If available, returns the name of the file containing the Java code source which was compiled into the class where this stack trace element is executing.- Returns:
- the name of the Java code source file which was compiled into the
class where this stack trace element is executing. If not
available, a
null
value is returned.
-
getLineNumber
public int getLineNumber()Returns the source file line number for the class where this stack trace element is executing.- Returns:
- the line number in the source file corresponding to where this stack trace element is executing.
-
getMethodName
Returns the name of the method where this stack trace element is executing.- Returns:
- the method in which this stack trace element is executing.
Returns <
unknown method
> if the name of the method cannot be determined.
-
hashCode
public int hashCode()Returns a hash code value for this stack trace element. -
isNativeMethod
public boolean isNativeMethod()Returnstrue
if the method name returned bygetMethodName()
is implemented as a native method.- Returns:
- true if the method is a native method
-
toString
Returns a string representation of this stack trace element.
-