Final

java.lang
Class StackTraceElement

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

public final class StackTraceElement
extends Object
implements Serializable

StackTraceElement represents a stack frame.

See Also:
Throwable.getStackTrace(), Serialized Form

Constructor Summary
StackTraceElement(String cls, String method, String file, int line)
          Create a StackTraceElement from the parameters.
 
Method Summary
 boolean equals(Object obj)
          Returns true if the specified object is another StackTraceElement instance representing the same execution point as this instance.
 String getClassName()
          Returns the full name (i.e. including package) of the class where this stack trace element is executing.
 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()
          Returns the source file line number 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()
          Returns a hash code value for this stack trace element.
 boolean isNativeMethod()
          Returns true if the method name returned by getMethodName() is implemented as a native method.
 String toString()
          Returns a string representation of this stack trace element.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StackTraceElement

public StackTraceElement(String cls,
                         String method,
                         String file,
                         int line)
Create a StackTraceElement from the parameters.

Parameters:
cls - The class name
method - The method name
file - The file name
line - The line number
Method Detail

equals

public boolean equals(Object obj)
Returns true if the specified object is another StackTraceElement instance representing the same execution point as this instance.

Overrides:
equals in class Object
Parameters:
obj - the object to compare to
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 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

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:
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

public String 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.

Overrides:
hashCode in class Object
Returns:
the receiver's hash.
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:
true if the method is a native method

toString

public String toString()
Returns a string representation of this stack trace element.

Overrides:
toString in class Object
Returns:
String a printable representation for the receiver.

Final

Licensed Materials - Property of IBM
© Copyright IBM Corp. 2006, 2007 All Rights Reserved.