public class AsyncInterceptorChainImpl extends Object implements AsyncInterceptorChain
Constructor and Description |
---|
AsyncInterceptorChainImpl(ComponentRegistry componentRegistry) |
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.
|
boolean |
addInterceptorBefore(AsyncInterceptor toAdd,
Class<? extends AsyncInterceptor> beforeInterceptor,
boolean isCustom)
Deprecated.
|
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> existingInterceptorType)
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.
|
String |
toString() |
public AsyncInterceptorChainImpl(ComponentRegistry componentRegistry)
public void addInterceptor(AsyncInterceptor interceptor, int position)
AsyncInterceptorChain
addInterceptor
in interface AsyncInterceptorChain
public void removeInterceptor(int position)
AsyncInterceptorChain
removeInterceptor
in interface AsyncInterceptorChain
public int size()
AsyncInterceptorChain
size
in interface AsyncInterceptorChain
public void removeInterceptor(Class<? extends AsyncInterceptor> clazz)
AsyncInterceptorChain
removeInterceptor
in interface AsyncInterceptorChain
public boolean addInterceptorAfter(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> afterInterceptor)
AsyncInterceptorChain
addInterceptorAfter
in interface AsyncInterceptorChain
afterInterceptor
exists@Deprecated public boolean addInterceptorBefore(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> beforeInterceptor, boolean isCustom)
public boolean addInterceptorBefore(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> beforeInterceptor)
AsyncInterceptorChain
addInterceptorBefore
in interface AsyncInterceptorChain
beforeInterceptor
existspublic boolean replaceInterceptor(AsyncInterceptor replacingInterceptor, Class<? extends AsyncInterceptor> existingInterceptorType)
AsyncInterceptorChain
replaceInterceptor
in interface AsyncInterceptorChain
replacingInterceptor
- the interceptor to add to the interceptor chainexistingInterceptorType
- the type of interceptor that should be swapped with the new onepublic void appendInterceptor(AsyncInterceptor ci, boolean isCustom)
AsyncInterceptorChain
appendInterceptor
in interface AsyncInterceptorChain
public CompletableFuture<Object> invokeAsync(InvocationContext ctx, VisitableCommand command)
AsyncInterceptorChain
invokeAsync
in interface AsyncInterceptorChain
public Object invoke(InvocationContext ctx, VisitableCommand command)
AsyncInterceptorChain
Note: Reusing the context for multiple invocations is allowed, however most context implementations are not thread-safe.
invoke
in interface AsyncInterceptorChain
public <T extends AsyncInterceptor> T findInterceptorExtending(Class<T> interceptorClass)
AsyncInterceptorChain
null
if there is none.findInterceptorExtending
in interface AsyncInterceptorChain
public <T extends AsyncInterceptor> T findInterceptorWithClass(Class<T> interceptorClass)
AsyncInterceptorChain
null
if there is none.findInterceptorWithClass
in interface AsyncInterceptorChain
public boolean containsInstance(AsyncInterceptor interceptor)
AsyncInterceptorChain
containsInstance
in interface AsyncInterceptorChain
public boolean containsInterceptorType(Class<? extends AsyncInterceptor> interceptorType)
AsyncInterceptorChain
containsInterceptorType
in interface AsyncInterceptorChain
public boolean containsInterceptorType(Class<? extends AsyncInterceptor> interceptorType, boolean alsoMatchSubClasses)
AsyncInterceptorChain
containsInterceptorType
in interface AsyncInterceptorChain
public List<AsyncInterceptor> getInterceptors()
getInterceptors
in interface AsyncInterceptorChain
Copyright © 2021 JBoss by Red Hat. All rights reserved.