public class HandlerException extends Object implements HandleableException
| Constructor and Description |
|---|
HandlerException() |
HandlerException(boolean mute) |
HandlerException(Class<? extends RuntimeException> defaultException,
String message)
Build a new handler exception where default Runtime exception is
defaultException. |
HandlerException(Class<? extends RuntimeException> defaultException,
String message,
boolean mute) |
HandlerException(String message)
Build a new handler exception where default Runtime exception is
RuntimeException. |
| Modifier and Type | Method and Description |
|---|---|
HandleableException |
config(Class<? extends Exception> caught,
Class<? extends RuntimeException> translateTo,
String message)
Mapping
root checked exception to translateTo unchecked. |
HandleableException |
config(Class<? extends Exception> caught,
String message)
Mapping
root checked exception to unchecked, RuntimeException. |
Class<? extends RuntimeException> |
getDefaultException() |
void |
handle(Exception caught) |
void |
handle(Exception caught,
String customMessage) |
boolean |
isMute() |
boolean |
isMute(Class<? extends Exception> clazz) |
HandleableException |
logInfoOff() |
HandleableException |
logInfoOn() |
HandleableException |
mute() |
HandleableException |
mute(Class<? extends Exception> clazz) |
void |
throwMessage(String message,
Object... args)
Throw a Default Exception with a specific message using the specified formatted string and arguments.
|
public HandlerException()
public HandlerException(boolean mute)
public HandlerException(String message)
RuntimeException.
and your default message is messagemessage - default messagepublic HandlerException(Class<? extends RuntimeException> defaultException, String message)
defaultException.
and your default message is messagedefaultException - default runtime exception when exception is catch for try / catch block.message - default messagepublic HandlerException(Class<? extends RuntimeException> defaultException, String message, boolean mute)
public HandleableException config(Class<? extends Exception> caught, Class<? extends RuntimeException> translateTo, String message)
HandleableExceptionroot checked exception to translateTo unchecked.config in interface HandleableExceptioncaught - checked exception expectedtranslateTo - translate to another unchecked exceptionmessage - content of exceptionpublic HandleableException config(Class<? extends Exception> caught, String message)
HandleableExceptionroot checked exception to unchecked, RuntimeException.config in interface HandleableExceptioncaught - checked exception expectedmessage - content of exceptionpublic void handle(Exception caught)
handle in interface HandleableExceptionpublic void handle(Exception caught, String customMessage)
handle in interface HandleableExceptionpublic void throwMessage(String message, Object... args)
HandleableExceptionthrowMessage in interface HandleableExceptionmessage - a format message, like: can not found method %s for class %sargs - Arguments referenced by the format specifiers in the format string.public Class<? extends RuntimeException> getDefaultException()
getDefaultException in interface HandleableExceptionpublic HandleableException mute()
mute in interface HandleableExceptionpublic HandleableException mute(Class<? extends Exception> clazz)
mute in interface HandleableExceptionpublic boolean isMute()
isMute in interface HandleableExceptionpublic boolean isMute(Class<? extends Exception> clazz)
isMute in interface HandleableExceptionpublic HandleableException logInfoOn()
logInfoOn in interface HandleableExceptionpublic HandleableException logInfoOff()
logInfoOff in interface HandleableExceptionCopyright © 2012–2020 jkniv, copyleft code. All rights reserved.