public final class ExceptionHandler
extends java.lang.Object
ExceptionHandlers are immutable. It is quite legal to save a reference to an exception handler and use it in any other context. We also treat arrays of ExceptionHandlers as immutable. Therefore the following code can be used to build an exception handler table that specifies two handlers covering an entire block of code:
ExceptionHandler[] hs = {
new ExceptionHandler(110, "Ljava.lang.NullPointerException;"),
new ExceptionHandler(220, "Ljava.io.IOException;");
};
for (int i = 0; i < 100; i++) {
handlers[i] = hs;
}
| Constructor and Description |
|---|
ExceptionHandler(int handler,
java.lang.String catchClass) |
ExceptionHandler(int handler,
java.lang.String catchClass,
java.lang.Object catchClassLoader) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(ExceptionHandler h) |
boolean |
equals(java.lang.Object o) |
java.lang.String |
getCatchClass() |
java.lang.Object |
getCatchClassLoader() |
int |
getHandler() |
int |
hashCode() |
public ExceptionHandler(int handler,
java.lang.String catchClass,
java.lang.Object catchClassLoader)
handler - the label for the handler codecatchClass - the type of exception that should be caught (in JVM format), or null if all
exceptions should be caught (as with 'finally')public ExceptionHandler(int handler,
java.lang.String catchClass)
public int getHandler()
public java.lang.Object getCatchClassLoader()
public java.lang.String getCatchClass()
public boolean equals(ExceptionHandler h)
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Object