|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Throwable
java.lang.Exception
com.mcdermottroe.exemplar.Exception
public abstract class Exception
A base class for all of the exceptions in the program. This is intended to provide nice chained exception backtraces for all derived exceptions.
| Constructor Summary | |
|---|---|
protected |
Exception()
Exception without a description. |
protected |
Exception(String message)
Exception with a description. |
protected |
Exception(String message,
Throwable cause)
Exception with a description and a reference to an exception which caused it. |
protected |
Exception(Throwable cause)
Exception with a reference to the exception that caused it. |
| Method Summary | |
|---|---|
int |
compareTo(Exception other)
Implement Comparable.compareTo(Object). |
protected static StackTraceElement[] |
copyStackTrace(StackTraceElement[] t)
A helper method for the implementations of Copyable.getCopy() in
child classes of this class to deep-copy a stack trace. |
boolean |
equals(Object o)
Implement Object.equals(Object) in a way which will be
consistent with hashCode(). |
private static String |
exceptionStackTrace(Throwable t)
Get the stack trace from the point at which the given exception was thrown. |
List<String> |
getBackTrace()
Get the backtrace as a List of Strings. |
int |
hashCode()
Implement Object.hashCode() in a way which will be consistent
with equals(Object). |
private static boolean |
throwablesEqual(Throwable a,
Throwable b)
Recursively test that two Throwables are equal. |
String |
toString()
Provide a full backtrace of all the exceptions which caused this exception to be thrown, (with a stacktrace for each exception if debugging is turned on). |
| Methods inherited from class java.lang.Throwable |
|---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.mcdermottroe.exemplar.Copyable |
|---|
getCopy |
| Constructor Detail |
|---|
protected Exception()
protected Exception(String message)
message - The description of the exception.
protected Exception(String message,
Throwable cause)
message - The description of the exception.cause - The cause of the exception.protected Exception(Throwable cause)
cause - The cause of the exception.| Method Detail |
|---|
public List<String> getBackTrace()
List of Strings.
List where each element is a step in the backtrace.protected static StackTraceElement[] copyStackTrace(StackTraceElement[] t)
Copyable.getCopy() in
child classes of this class to deep-copy a stack trace.
t - The stack trace to copy.
public boolean equals(Object o)
Object.equals(Object) in a way which will be
consistent with hashCode().
equals in class Objecto - The other Object to compare with.
o, false otherwise.
private static boolean throwablesEqual(Throwable a,
Throwable b)
Throwables are equal. This is
necessary because Throwable uses the default Object.equals(Object) which only compares referential equality.
a - The first of the two Throwables.b - The second of the two Throwables.
Throwables are equal.public int hashCode()
Object.hashCode() in a way which will be consistent
with equals(Object).
hashCode in class Objectpublic String toString()
toString in class ThrowableString for this Exception.private static String exceptionStackTrace(Throwable t)
t - The Throwable to get the stack trace from.
String representation of the stack trace in the
format of one frame per line. All lines are indented by
Strings.indent(String).public int compareTo(Exception other)
Comparable.compareTo(Object).
compareTo in interface Comparable<Exception>other - The Exception to compare against.
Comparable.compareTo(Object).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||