public class ExecutionFactoryBuilderDelegate<SELF extends ExecutionFactoryBuilderDelegate,DELEGATE extends ExecutionFactoryBuilder> extends Object implements ExecutionFactoryBuilder<SELF>
| Constructor and Description |
|---|
ExecutionFactoryBuilderDelegate(DELEGATE delegate) |
| Modifier and Type | Method and Description |
|---|---|
ExecutionFactory |
buildExecutionFactory()
Builds the
ExecutionFactory. |
protected DELEGATE |
getDelegate() |
<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. |
public ExecutionFactoryBuilderDelegate(DELEGATE delegate)
public SELF withPreExecutionListener(OnPreExecutionListener... onPreExecutionListeners)
ExecutionFactoryBuilderOnPreExecutionListeners to be executed before the execution.withPreExecutionListener in interface ExecutionFactoryBuilder<SELF extends ExecutionFactoryBuilderDelegate>onPreExecutionListeners - The listeners to set.public SELF withPreExecutionListener(List<OnPreExecutionListener> onPreExecutionListeners)
ExecutionFactoryBuilderOnPreExecutionListeners to be executed before the execution.withPreExecutionListener in interface ExecutionFactoryBuilder<SELF extends ExecutionFactoryBuilderDelegate>onPreExecutionListeners - The listeners to set.public SELF withPostExecutionListener(OnSuccessListener... onSuccessListeners)
ExecutionFactoryBuilderOnPreExecutionListeners to be executed after the execution.withPostExecutionListener in interface ExecutionFactoryBuilder<SELF extends ExecutionFactoryBuilderDelegate>onSuccessListeners - The listeners to set.public SELF withPostExecutionListener(List<OnSuccessListener> onSuccessListeners)
ExecutionFactoryBuilderOnPreExecutionListeners to be executed after the execution.withPostExecutionListener in interface ExecutionFactoryBuilder<SELF extends ExecutionFactoryBuilderDelegate>onSuccessListeners - The listeners to set.public <T extends Throwable> SELF withExceptionHandler(Class<T> exceptionClass, ExceptionHandler<T> exceptionHandler)
ExecutionFactoryBuilderExceptionHandler 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.withExceptionHandler in interface ExecutionFactoryBuilder<SELF extends ExecutionFactoryBuilderDelegate>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.public <T extends Throwable> SELF withExceptionHandler(DefinedExceptionHandler<T> exceptionHandler)
ExecutionFactoryBuilderDefinedExceptionHandler 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.withExceptionHandler in interface ExecutionFactoryBuilder<SELF extends ExecutionFactoryBuilderDelegate>T - The subtype of Throwable that will be handled here.exceptionHandler - The handler for the exception.public <T extends RuntimeException> SELF withIgnoredExceptionType(Class<T> exceptionClass)
ExecutionFactoryBuilderRuntimeException and it's subclasses to be ignored by the exception handlers.withIgnoredExceptionType in interface ExecutionFactoryBuilder<SELF extends ExecutionFactoryBuilderDelegate>T - The type of the RuntimeException to ignore.exceptionClass - The class of the runtime exception to ignore. it must extend RuntimeExceptionpublic ExecutionFactory buildExecutionFactory()
ExecutionFactoryBuilderExecutionFactory.buildExecutionFactory in interface ExecutionFactoryBuilder<SELF extends ExecutionFactoryBuilderDelegate>protected DELEGATE getDelegate()
Copyright © 2019. All rights reserved.