Package com.github.toolarium.common.util
Class ExceptionWrapper.DefaultExceptionHandler
java.lang.Object
com.github.toolarium.common.util.ExceptionWrapper.DefaultExceptionHandler
- All Implemented Interfaces:
ExceptionWrapper.ExceptionHandler
- Enclosing class:
ExceptionWrapper
public class ExceptionWrapper.DefaultExceptionHandler
extends Object
implements ExceptionWrapper.ExceptionHandler
This class implements the default exception handler behavior
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Throwable>
TcreateExceptionInstance(Throwable t, Class<T> newExceptionClazz) Creates the new exceptionprotected <T> Constructor<T> getMessageAndThrowableConstructor(Class<T> newExceptionClazz) Gets the default throwable constructor if is any is definedprotected <T> Constructor<T> getMessageConstructor(Class<T> newExceptionClazz) Gets the default message constructor if is any is definedprotected <T> Constructor<T> getThrowableConstructor(Class<T> newExceptionClazz) Gets the default throwable constructor if is any is defined
-
Constructor Details
-
DefaultExceptionHandler
public DefaultExceptionHandler()
-
-
Method Details
-
createExceptionInstance
public <T extends Throwable> T createExceptionInstance(Throwable t, Class<T> newExceptionClazz) throws InstantiationException, IllegalAccessException, InvocationTargetException Description copied from interface:ExceptionWrapper.ExceptionHandlerCreates the new exception- Specified by:
createExceptionInstancein interfaceExceptionWrapper.ExceptionHandler- Type Parameters:
T- the generic type- Parameters:
t- the current exceptionnewExceptionClazz- the new exception class- Returns:
- the new instance
- Throws:
InstantiationException- in case of errorIllegalAccessException- in case of errorInvocationTargetException- in case of error- See Also:
-
getMessageConstructor
Gets the default message constructor if is any is defined- Type Parameters:
T- the generic type- Parameters:
newExceptionClazz- the current class- Returns:
- the constructor or null if no constructor was found
-
getThrowableConstructor
Gets the default throwable constructor if is any is defined- Type Parameters:
T- the generic type- Parameters:
newExceptionClazz- the current class- Returns:
- the constructor or null if no constructor was found
-
getMessageAndThrowableConstructor
Gets the default throwable constructor if is any is defined- Type Parameters:
T- the generic type- Parameters:
newExceptionClazz- the current class- Returns:
- the constructor or null if no constructor was found
-