public interface ExecutionFactoryBuilder<SELF extends ExecutionFactoryBuilder>
| Modifier and Type | Method and Description |
|---|---|
ExecutionFactory |
buildExecutionFactory()
Builds the
ExecutionFactory. |
<T extends Throwable> |
withExceptionHandler(Class<T> exceptionClass,
ExceptionHandler<T> exceptionHandler)
Adds an
ExceptionHandler to handle a specific kind of Throwable or it's subclasses. |
<T extends Throwable> |
withExceptionHandler(DefinedExceptionHandler<T> exceptionHandler)
Adds a
DefinedExceptionHandler to handle a specific kind of Throwable or it's subclasses. |
<T extends RuntimeException> |
withIgnoredExceptionType(Class<T> exceptionClass)
Allows a specific
RuntimeException and it's subclasses to be ignored by the exception handlers. |
SELF |
withPostExecutionListener(List<OnSuccessListener> onSuccessListeners)
Adds a list of
OnPreExecutionListeners to be executed after the execution. |
SELF |
withPostExecutionListener(OnSuccessListener... onSuccessListeners)
Adds an array of
OnPreExecutionListeners to be executed after the execution. |
SELF |
withPreExecutionListener(List<OnPreExecutionListener> onPreExecutionListeners)
Adds a list of
OnPreExecutionListeners to be executed before the execution. |
SELF |
withPreExecutionListener(OnPreExecutionListener... onPreExecutionListeners)
Adds an array of
OnPreExecutionListeners to be executed before the execution. |
SELF withPreExecutionListener(OnPreExecutionListener... onPreExecutionListeners)
OnPreExecutionListeners to be executed before the execution.onPreExecutionListeners - The listeners to set.SELF withPreExecutionListener(List<OnPreExecutionListener> onPreExecutionListeners)
OnPreExecutionListeners to be executed before the execution.onPreExecutionListeners - The listeners to set.SELF withPostExecutionListener(OnSuccessListener... onSuccessListeners)
OnPreExecutionListeners to be executed after the execution.onSuccessListeners - The listeners to set.SELF withPostExecutionListener(List<OnSuccessListener> onSuccessListeners)
OnPreExecutionListeners to be executed after the execution.onSuccessListeners - The listeners to set.<T extends Throwable> SELF withExceptionHandler(Class<T> exceptionClass, ExceptionHandler<T> exceptionHandler)
ExceptionHandler to handle a specific kind of Throwable or it's subclasses. Handlers are
triggered in the order they were set into the context with only the first match found triggering. This means that
if the following case would happen:
executor.withExceptionHandler(Throwable.class, myThrowableExceptionHandler)
.withExceptionHandler(RuntimeException.class, myRuntimeExceptionExceptionHandler);
And a RuntimeException is thrown, then the myThrowableExceptionHandler would catch it and handle it.
Additionally, any non handled exceptions, unless ignored using DefaultExecutionFactoryBuilder.withIgnoredExceptionType(Class),
will be wrapped in an UnhandledException and thrown as such.T - The subtype of Throwable that will be handled here.exceptionClass - The exception type to handle. This will include the specific exception and all it's
subclasses.exceptionHandler - The handler for the exception.<T extends Throwable> SELF withExceptionHandler(DefinedExceptionHandler<T> exceptionHandler)
DefinedExceptionHandler to handle a specific kind of Throwable or it's subclasses. Handlers are
triggered in the order they were set into the context with only the first match found triggering. This means that
if the following case would happen:
executor.<Throwable>withExceptionHandler(myDefinedThrowableExceptionHandler)
.<RuntimeException>withExceptionHandler(myDefinedRuntimeExceptionExceptionHandler);
And a RuntimeException is thrown, then the myDefinedThrowableExceptionHandler would catch it and handle it.
Additionally, any non handled exceptions, unless ignored using DefaultExecutionFactoryBuilder.withIgnoredExceptionType(Class),
will be wrapped in an UnhandledException and thrown as such.T - The subtype of Throwable that will be handled here.exceptionHandler - The handler for the exception.<T extends RuntimeException> SELF withIgnoredExceptionType(Class<T> exceptionClass)
RuntimeException and it's subclasses to be ignored by the exception handlers.T - The type of the RuntimeException to ignore.exceptionClass - The class of the runtime exception to ignore. it must extend RuntimeExceptionExecutionFactory buildExecutionFactory()
ExecutionFactory.Copyright © 2019. All rights reserved.