org.naftulin.classpathexplorer.stacktrace.impl
Class StackTraceElementExtension

java.lang.Object
  |
  +--org.naftulin.classpathexplorer.stacktrace.impl.StackTraceElementExtension
All Implemented Interfaces:
java.io.Serializable

public class StackTraceElementExtension
extends java.lang.Object
implements java.io.Serializable

Combines stack element with resource information. The class is useful when it is needed to know which resource generates an exception. getExceptionDecorator(java.lang.Exception) should be used to wrap the exception. When the wrapped exception is printed out, (for example to log file), each stack trace element will have resource information available in addition to the stack trace information.

Version:
1.0
Author:
henry naftulin
See Also:
Serialized Form

Constructor Summary
StackTraceElementExtension(java.lang.StackTraceElement element)
          Creates a stack trace extension based on the stack trace element.
 
Method Summary
 java.lang.String getArchiveName()
          Returns the name of the archive the class resides in, or not found if class was not found.
 java.io.File getClassArchiveSource()
          Returns the file for archive for the class that this instance of the stack trace is describing.
static java.lang.Exception getExceptionDecorator(java.lang.Exception e)
          Returns exception that the stack trace with additional resource information.
 java.lang.StackTraceElement getStackTraceElement()
          Returns the stack trace element.
 boolean isDirectory()
          Returns true if the class described in this stack trace is loaded from directory.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StackTraceElementExtension

public StackTraceElementExtension(java.lang.StackTraceElement element)
Creates a stack trace extension based on the stack trace element.

Parameters:
element -
Method Detail

getClassArchiveSource

public java.io.File getClassArchiveSource()
Returns the file for archive for the class that this instance of the stack trace is describing. The file could be null, for example, if resource is not found.

Returns:
the file for archive for the class that this instance of the stack trace is describing.

getStackTraceElement

public java.lang.StackTraceElement getStackTraceElement()
Returns the stack trace element.

Returns:
the stack trace element

isDirectory

public boolean isDirectory()
Returns true if the class described in this stack trace is loaded from directory. Otherwise, the class described in this stack trace could not be found, or is loaded from and archive (e.g. zip or jar).

Returns:
true if the class described in this stack trace is loaded from directory.

getArchiveName

public java.lang.String getArchiveName()
Returns the name of the archive the class resides in, or not found if class was not found.

Returns:
the name of the archive the class resides in, or not found if class was not found.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getExceptionDecorator

public static java.lang.Exception getExceptionDecorator(java.lang.Exception e)
Returns exception that the stack trace with additional resource information.

Returns:
exception with additional stack trace information.
Throws:
exception - that will be decorated, resorce infomation will be added.


Copyright © 2006 Henry Naftulin. All Rights Reserved.