public class Unhandled extends IllegalArgumentException
Exceptions appropriate for unhandled-case errors, such as unexpected default or else clauses.
switch (returnCode) {
case OK: return "Good job";
case FAILURE: return "Oh no!";
default: throw Unhandled.integerException(returnCode);
}
if (obj instanceof Salad) {
return VEGETABLE;
} else if (obj instanceof Computer) {
return MINERAL;
} else if (obj instanceof Employee) {
if (obj instanceof Programmer) {
return MINERAL;
} else {
return ANIMAL;
}
} else {
throw Unhandled.classException(obj);
}
| Modifier and Type | Method and Description |
|---|---|
static Unhandled |
byteException(byte b) |
static Unhandled |
charException(char c) |
static Unhandled |
classException(Object o) |
static Unhandled |
doubleException(double d) |
static Unhandled |
enumException(Enum<?> e) |
static Unhandled |
floatException(float f) |
static Unhandled |
integerException(int i) |
static Unhandled |
objectException(Object obj) |
static Unhandled |
shortException(short s) |
static Unhandled |
stringException(String str) |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic static Unhandled byteException(byte b)
public static Unhandled charException(char c)
public static Unhandled shortException(short s)
public static Unhandled integerException(int i)
public static Unhandled floatException(float f)
public static Unhandled doubleException(double d)