Build 1.0_r1(from source)

java.lang
Class StackTraceElement

java.lang.Object
  extended by java.lang.StackTraceElement
All Implemented Interfaces:
Serializable

public final class StackTraceElement
extends Object
implements Serializable

An implementation of this class is provided, but the documented constructor can be used by the VM specific implementation to create instances. StackTraceElement represents a stack frame.

Since:
1.4
See Also:
Throwable.getStackTrace(), Serialized Form

Field Summary
(package private)  String declaringClass
           
(package private)  String fileName
           
(package private)  int lineNumber
           
(package private)  String methodName
           
 
Constructor Summary
StackTraceElement(String cls, String method, String file, int line)
           Constructs a StackTraceElement for an execution point.
 
Method Summary
 boolean equals(Object obj)
          Compare this object with the object passed in
 String getClassName()
          Returns the full name (i.e.
 String 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.
 int getLineNumber()
          If available, returns the line number in the source for the class where this stack trace element is executing.
 String getMethodName()
          Returns the name of the method where this stack trace element is executing.
 int hashCode()
          Return this StackTraceElement objects hash code
 boolean isNativeMethod()
          Returns true if the method name returned by getMethodName() is implemented as a native method.
 String toString()
          Return a String representing this StackTraceElement object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

declaringClass

String declaringClass

methodName

String methodName

fileName

String fileName

lineNumber

int lineNumber
Constructor Detail

StackTraceElement

public StackTraceElement(String cls,
                         String method,
                         String file,
                         int line)

Constructs a StackTraceElement for an execution point.

Parameters:
cls - The fully qualified name of the class where execution is at.
method - The name of the method where execution is at.
file - The name of the file where execution is at or null.
line - The line of the file where execution is at, a negative number if unknown or -2 if the execution is in a native method.
Throws:
NullPointerException - if cls or method is null.
Since:
1.5
Method Detail

equals

public boolean equals(Object obj)
Compare this object with the object passed in

Overrides:
equals in class Object
Parameters:
obj - Object to compare with
Returns:
boolean true if the object is the same as this object false if it is different from this object.
See Also:
Object.hashCode()

getClassName

public String getClassName()
Returns the full name (i.e. including the package) of the class where this stack trace element is executing.

Returns:
the fully qualified type name of the class where this stack trace element is executing.

getFileName

public String 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:
if available, the name of the file containing the Java code source for the stack trace element's executing class. If no such detail is available, a null value is returned.

getLineNumber

public int getLineNumber()
If available, returns the line number in the source for the class where this stack trace element is executing.

Returns:
if available, the line number in the source file for the class where this stack trace element is executing. If no such detail is available, a number less than 0.

getMethodName

public String getMethodName()
Returns the name of the method where this stack trace element is executing.

Returns:
the name of the method where this stack trace element is executing.

hashCode

public int hashCode()
Return this StackTraceElement objects hash code

Overrides:
hashCode in class Object
Returns:
This objects hash code
See Also:
Object.equals(java.lang.Object)

isNativeMethod

public boolean isNativeMethod()
Returns true if the method name returned by getMethodName() is implemented as a native method.

Returns:
if the method in which this stack trace element is executing is a native method

toString

public String toString()
Return a String representing this StackTraceElement object

Overrides:
toString in class Object
Returns:
String representing this object

Build 1.0_r1(from source)

Please submit a feedback, bug or feature