public class EmptyAsyncInterceptorChain extends Object implements AsyncInterceptorChain
| Modifier and Type | Field and Description |
|---|---|
static EmptyAsyncInterceptorChain |
INSTANCE |
| Constructor and Description |
|---|
EmptyAsyncInterceptorChain() |
| Modifier and Type | Method and Description |
|---|---|
void |
addInterceptor(AsyncInterceptor interceptor,
int position)
Inserts the given interceptor at the specified position in the chain (0 based indexing).
|
boolean |
addInterceptorAfter(AsyncInterceptor toAdd,
Class<? extends AsyncInterceptor> afterInterceptor)
Adds a new interceptor in list after an interceptor of a given type.
|
boolean |
addInterceptorBefore(AsyncInterceptor toAdd,
Class<? extends AsyncInterceptor> beforeInterceptor)
Adds a new interceptor in list before an interceptor of a given type.
|
void |
appendInterceptor(AsyncInterceptor ci,
boolean isCustom)
Appends at the end.
|
boolean |
containsInstance(AsyncInterceptor interceptor)
Checks whether the chain contains the supplied interceptor instance.
|
boolean |
containsInterceptorType(Class<? extends AsyncInterceptor> interceptorType)
Checks whether the chain contains an interceptor with the given class.
|
boolean |
containsInterceptorType(Class<? extends AsyncInterceptor> interceptorType,
boolean alsoMatchSubClasses)
Checks whether the chain contains an interceptor with the given class, or a subclass.
|
<T extends AsyncInterceptor> |
findInterceptorExtending(Class<T> interceptorClass)
Returns the first interceptor extending the given class, or
null if there is none. |
<T extends AsyncInterceptor> |
findInterceptorWithClass(Class<T> interceptorClass)
Returns the first interceptor with the given class, or
null if there is none. |
List<AsyncInterceptor> |
getInterceptors() |
Object |
invoke(InvocationContext ctx,
VisitableCommand command)
Walks the command through the interceptor chain.
|
CompletableFuture<Object> |
invokeAsync(InvocationContext ctx,
VisitableCommand command)
Walks the command through the interceptor chain.
|
void |
removeInterceptor(Class<? extends AsyncInterceptor> clazz)
Removes all the occurrences of supplied interceptor type from the chain.
|
void |
removeInterceptor(int position)
Removes the interceptor at the given position.
|
boolean |
replaceInterceptor(AsyncInterceptor replacingInterceptor,
Class<? extends AsyncInterceptor> toBeReplacedInterceptorType)
Replaces an existing interceptor of the given type in the interceptor chain with a new interceptor
instance passed as parameter.
|
int |
size()
Returns the number of interceptors in the chain.
|
public static final EmptyAsyncInterceptorChain INSTANCE
public List<AsyncInterceptor> getInterceptors()
getInterceptors in interface AsyncInterceptorChainpublic void addInterceptor(AsyncInterceptor interceptor, int position)
AsyncInterceptorChainaddInterceptor in interface AsyncInterceptorChainpublic void removeInterceptor(int position)
AsyncInterceptorChainremoveInterceptor in interface AsyncInterceptorChainpublic int size()
AsyncInterceptorChainsize in interface AsyncInterceptorChainpublic void removeInterceptor(Class<? extends AsyncInterceptor> clazz)
AsyncInterceptorChainremoveInterceptor in interface AsyncInterceptorChainpublic boolean addInterceptorAfter(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> afterInterceptor)
AsyncInterceptorChainaddInterceptorAfter in interface AsyncInterceptorChainafterInterceptor existspublic boolean addInterceptorBefore(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> beforeInterceptor)
AsyncInterceptorChainaddInterceptorBefore in interface AsyncInterceptorChainbeforeInterceptor existspublic boolean replaceInterceptor(AsyncInterceptor replacingInterceptor, Class<? extends AsyncInterceptor> toBeReplacedInterceptorType)
AsyncInterceptorChainreplaceInterceptor in interface AsyncInterceptorChainreplacingInterceptor - the interceptor to add to the interceptor chaintoBeReplacedInterceptorType - the type of interceptor that should be swapped with the new onepublic void appendInterceptor(AsyncInterceptor ci, boolean isCustom)
AsyncInterceptorChainappendInterceptor in interface AsyncInterceptorChainpublic Object invoke(InvocationContext ctx, VisitableCommand command)
AsyncInterceptorChainNote: Reusing the context for multiple invocations is allowed, however most context implementations are not thread-safe.
invoke in interface AsyncInterceptorChainpublic CompletableFuture<Object> invokeAsync(InvocationContext ctx, VisitableCommand command)
AsyncInterceptorChaininvokeAsync in interface AsyncInterceptorChainpublic <T extends AsyncInterceptor> T findInterceptorExtending(Class<T> interceptorClass)
AsyncInterceptorChainnull if there is none.findInterceptorExtending in interface AsyncInterceptorChainpublic <T extends AsyncInterceptor> T findInterceptorWithClass(Class<T> interceptorClass)
AsyncInterceptorChainnull if there is none.findInterceptorWithClass in interface AsyncInterceptorChainpublic boolean containsInstance(AsyncInterceptor interceptor)
AsyncInterceptorChaincontainsInstance in interface AsyncInterceptorChainpublic boolean containsInterceptorType(Class<? extends AsyncInterceptor> interceptorType)
AsyncInterceptorChaincontainsInterceptorType in interface AsyncInterceptorChainpublic boolean containsInterceptorType(Class<? extends AsyncInterceptor> interceptorType, boolean alsoMatchSubClasses)
AsyncInterceptorChaincontainsInterceptorType in interface AsyncInterceptorChainCopyright © 2021 JBoss by Red Hat. All rights reserved.