public final class StackTraceElement extends Object implements Serializable
Constructor and Description |
---|
StackTraceElement(String className,
String methodName,
String fileName,
int lineNumber)
Create a new StackTraceElement representing a given source location.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Returns true if the given object is also a StackTraceElement and all
attributes, except the native flag, are equal (either the same attribute
between the two elments are null, or both satisfy Object.equals).
|
String |
getClassName()
Returns the fully qualified class name, or null if unknown.
|
String |
getFileName()
Returns the name of the file, or null if unknown.
|
int |
getLineNumber()
Returns the line number in the file, or a negative number if unknown.
|
String |
getMethodName()
Returns the method name in the class, or null if unknown.
|
int |
hashCode()
Returns the hashCode of this StackTraceElement.
|
boolean |
isNativeMethod()
Returns true if the method is native, or false if it is not or unknown.
|
String |
toString()
Returns a string representation of this stack trace element.
|
public StackTraceElement(String className, String methodName, String fileName, int lineNumber)
className
- the fully qualified name of the classmethodName
- the name of the methodfileName
- the name of the file, null if unknownlineNumber
- the line in the file, negative if unknown, or -2
if this method is nativepublic String getFileName()
SourceFile
attribute of the class file
format, if present.public int getLineNumber()
LineNumberTable
attribute
of the method in the class file format, if present.public String getClassName()
public String getMethodName()
<init>
; if the execution point is in the class
initializer, the name is <clinit>
.public boolean isNativeMethod()
public String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)
public boolean equals(Object o)
equals
in class Object
o
- the object to compareObject.hashCode()
public int hashCode()
hashCode
in class Object
Object.equals(Object)
,
System.identityHashCode(Object)