SELF - The type of sublclass of the DefaultExecutionFactoryBuilder. This will be returned by each builder method declared here.public class DefaultExecutionFactoryBuilder<SELF extends DefaultExecutionFactoryBuilder> extends Object implements ExecutionFactoryBuilder<SELF>
InstanceExecutionFactoryBuilder and StaticExecutionFactoryBuilder classes. Allows the child classes to buildExecutionFactory
ExecutionFactory instances to include on the execution buildExecutionFactory.DefinedExceptionHandler,
ExceptionHandler| Constructor and Description |
|---|
DefaultExecutionFactoryBuilder() |
| 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> postExecutionListeners)
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 SELF withPreExecutionListener(OnPreExecutionListener... onPreExecutionListeners)
OnPreExecutionListeners to be executed before the execution.withPreExecutionListener in interface ExecutionFactoryBuilder<SELF extends DefaultExecutionFactoryBuilder>onPreExecutionListeners - The listeners to set.public SELF withPreExecutionListener(List<OnPreExecutionListener> onPreExecutionListeners)
OnPreExecutionListeners to be executed before the execution.withPreExecutionListener in interface ExecutionFactoryBuilder<SELF extends DefaultExecutionFactoryBuilder>onPreExecutionListeners - The listeners to set.public SELF withPostExecutionListener(OnSuccessListener... onSuccessListeners)
OnPreExecutionListeners to be executed after the execution.withPostExecutionListener in interface ExecutionFactoryBuilder<SELF extends DefaultExecutionFactoryBuilder>onSuccessListeners - The listeners to set.public SELF withPostExecutionListener(List<OnSuccessListener> postExecutionListeners)
OnPreExecutionListeners to be executed after the execution.withPostExecutionListener in interface ExecutionFactoryBuilder<SELF extends DefaultExecutionFactoryBuilder>postExecutionListeners - The listeners to set.public <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 withIgnoredExceptionType(Class),
will be wrapped in an UnhandledException and thrown as such.withExceptionHandler in interface ExecutionFactoryBuilder<SELF extends DefaultExecutionFactoryBuilder>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)
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 withIgnoredExceptionType(Class),
will be wrapped in an UnhandledException and thrown as such.withExceptionHandler in interface ExecutionFactoryBuilder<SELF extends DefaultExecutionFactoryBuilder>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)
RuntimeException and it's subclasses to be ignored by the exception handlers.withIgnoredExceptionType in interface ExecutionFactoryBuilder<SELF extends DefaultExecutionFactoryBuilder>T - The type of the RuntimeException to ignore.exceptionClass - The class of the runtime exception to ignore. it must extend RuntimeExceptionpublic ExecutionFactory buildExecutionFactory()
ExecutionFactory.buildExecutionFactory in interface ExecutionFactoryBuilder<SELF extends DefaultExecutionFactoryBuilder>Copyright © 2019. All rights reserved.