SELF - The type of sublclass of the ExecutionBuilderFactory. This will be returned by each builder method declared here.RESULT - The type of result returned by the execution to build.public class ExecutionBuilderFactory<SELF extends ExecutionBuilderFactory,RESULT> extends Object
InstanceExecutionBuilderFactory and StaticExecutionBuilderFactory classes. Allows the child classes to build
ExecutionContext instances to include on the execution build.| Constructor and Description |
|---|
ExecutionBuilderFactory() |
| Modifier and Type | Method and Description |
|---|---|
protected ExecutionContext<RESULT> |
build()
Builds the
ExecutionContext. |
<T extends Throwable> |
withDefaultExceptionHandler(Class<T> exceptionClass,
ExceptionHandler<T> exceptionHandler)
Adds a default
DefinedExceptionHandler to handle a specific kind of Throwable or it's subclasses. |
<T extends Throwable> |
withDefaultExceptionHandler(DefinedExceptionHandler<T> exceptionHandler)
Adds a default
DefinedExceptionHandler to handle a specific kind of Throwable or it's subclasses. |
<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. |
SELF |
withExecutor(Executor<RESULT> executor)
Defines the
Executor that will handle the threads used on the running of the method. |
<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<PostExecutionListener> postExecutionListeners)
Adds a list of
PostExecutionListeners to be executed after the execution. |
SELF |
withPostExecutionListener(PostExecutionListener... postExecutionListeners)
Adds an array of
PostExecutionListeners to be executed after the execution. |
SELF |
withPreExecutionListener(List<PreExecutionListener> preExecutionListeners)
Adds a list of
PreExecutionListeners to be executed before the execution. |
SELF |
withPreExecutionListener(PreExecutionListener... preExecutionListeners)
Adds an array of
PreExecutionListeners to be executed before the execution. |
public SELF withExecutor(Executor<RESULT> executor)
Executor that will handle the threads used on the running of the method.executor - The handler to set.public SELF withPreExecutionListener(PreExecutionListener... preExecutionListeners)
PreExecutionListeners to be executed before the execution.preExecutionListeners - The listeners to set.public SELF withPreExecutionListener(List<PreExecutionListener> preExecutionListeners)
PreExecutionListeners to be executed before the execution.preExecutionListeners - The listeners to set.public SELF withPostExecutionListener(PostExecutionListener... postExecutionListeners)
PostExecutionListeners to be executed after the execution.postExecutionListeners - The listeners to set.public SELF withPostExecutionListener(List<PostExecutionListener> postExecutionListeners)
PostExecutionListeners to be executed after the execution.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.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.T - The subtype of Throwable that will be handled here.exceptionHandler - The handler for the exception.public <T extends Throwable> SELF withDefaultExceptionHandler(Class<T> exceptionClass, ExceptionHandler<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. If no match was found, then this
default handler comes in play. If there is no default handler set, then the exception, unless ignored using 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.public <T extends Throwable> SELF withDefaultExceptionHandler(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. If no match was found, then this
default handler comes in play. If there is no default handler set, then the exception, unless ignored using 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.public <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 RuntimeExceptionprotected ExecutionContext<RESULT> build()
ExecutionContext.Copyright © 2019. All rights reserved.