aicas logoJamaica 6.4 release 1

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 class that represents an entry in a stack trace, e.g., the stack trace of an exception. Each entry represents a call point, only the topmost entry represents the current position within a method.

Since:
1.4
See Also:
Serialized Form

Constructor Summary
StackTraceElement(String declaringClass, String methodName, String fileName, int lineNumber)
          Constructor to create a StackTraceElement pointing to a specific execution point.
 
Method Summary
 boolean equals(Object obj)
          equals returns true if this represents the same stack frame element as obj.
 String getClassName()
          getClassName returns the fully qualified name of the class that contains the method this represents.
 String getFileName()
          getFileName returns the name of the source file that contains the method represented by this frame.
 int getLineNumber()
          getLineNumber returns the line number in the source file that contains the position represented by this.
 String getMethodName()
          getMethodName returns the name of the method represented by this.
 int hashCode()
          hashCode creates a hash code value for this stackframe element.
 boolean isNativeMethod()
          isNativeMethod returns true iff the method represented by this stack frame is native (or compiled).
 String toString()
          toString converts this stack frame element to a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StackTraceElement

public StackTraceElement(String declaringClass,
                         String methodName,
                         String fileName,
                         int lineNumber)
Constructor to create a StackTraceElement pointing to a specific execution point.

Parameters:
declaringClass - The name of the class declaring the method.
methodName - The name of the method in this frame.
fileName - The name of the source file declaring the class, null if not available.
lineNumber - The line number in the source file, a negative value if this information is not available, -2 if the method is native.
Throws:
NullPointerException - if declaringClass or methodName is null.
Since:
1.5
Method Detail

getFileName

public String getFileName()
getFileName returns the name of the source file that contains the method represented by this frame.

Returns:
the source code file name or null if this information is not available.

getLineNumber

public int getLineNumber()
getLineNumber returns the line number in the source file that contains the position represented by this.

Returns:
the line number, a negative value if this information is not available.

getClassName

public String getClassName()
getClassName returns the fully qualified name of the class that contains the method this represents.

Returns:
the class name, never null.

getMethodName

public String getMethodName()
getMethodName returns the name of the method represented by this.

Returns:
the method name, never null.

isNativeMethod

public boolean isNativeMethod()
isNativeMethod returns true iff the method represented by this stack frame is native (or compiled).

Returns:
true iff this is a native method.

toString

public String toString()
toString converts this stack frame element to a string. The String will be of the form

  "..(:)"
 

The ":" will be omitted if this information is not available. ":" will be replaced by "Unknown Source" if it is unknown or "Native Method" if it is a native method.

Overrides:
toString in class Object
Returns:
a string representing this stack frame element, never null.

equals

public boolean equals(Object obj)
equals returns true if this represents the same stack frame element as obj.

Overrides:
equals in class Object
Parameters:
obj - another obj.
Returns:
true iff obj is an instance of StackTraceElement and has euqal getFileName, getLineNumber, getClassName and getMethodName values.

hashCode

public int hashCode()
hashCode creates a hash code value for this stackframe element.

Overrides:
hashCode in class Object
Returns:
a hashcode computer from the declaringClass and methodName.

aicas logoJamaica 6.4 release 1

aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2015 aicas GmbH. All Rights Reserved.