Package ca.uhn.fhir.interceptor.api
Interface IInterceptorService
-
- All Superinterfaces:
IInterceptorBroadcaster
- All Known Implementing Classes:
InterceptorService
public interface IInterceptorService extends IInterceptorBroadcaster
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<Object>getAllRegisteredInterceptors()Returns all currently registered interceptors (excluding any thread local interceptors).voidregisterAnonymousInterceptor(Pointcut thePointcut, int theOrder, IAnonymousInterceptor theInterceptor)voidregisterAnonymousInterceptor(Pointcut thePointcut, IAnonymousInterceptor theInterceptor)booleanregisterInterceptor(Object theInterceptor)Register an interceptor.voidregisterInterceptors(Collection<?> theInterceptors)booleanregisterThreadLocalInterceptor(Object theInterceptor)Register an interceptor that will be used in aThreadLocalcontext.voidunregisterAllInterceptors()Unregisters all registered interceptors.booleanunregisterInterceptor(Object theInterceptor)Unregister an interceptor.voidunregisterInterceptors(Collection<?> theInterceptors)voidunregisterThreadLocalInterceptor(Object theInterceptor)Unregisters a ThreadLocal interceptor-
Methods inherited from interface ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster
callHooks, callHooksAndReturnObject, hasHooks
-
-
-
-
Method Detail
-
registerThreadLocalInterceptor
boolean registerThreadLocalInterceptor(Object theInterceptor)
Register an interceptor that will be used in aThreadLocalcontext. This means that events will only be broadcast to the given interceptor if they were fired from the current thread.Note that it is almost always desirable to call this method with a try-finally statement that removes the interceptor afterwards, since this can lead to memory leakage, poor performance due to ever-increasing numbers of interceptors, etc.
Note that most methods such as
getAllRegisteredInterceptors()andunregisterAllInterceptors()do not affect thread local interceptors as they are kept in a separate list.- Parameters:
theInterceptor- The interceptor- Returns:
- Returns
trueif at least one valid hook method was found on this interceptor
-
unregisterThreadLocalInterceptor
void unregisterThreadLocalInterceptor(Object theInterceptor)
Unregisters a ThreadLocal interceptor- Parameters:
theInterceptor- The interceptor- See Also:
registerThreadLocalInterceptor(Object)
-
registerInterceptor
boolean registerInterceptor(Object theInterceptor)
Register an interceptor. This method has no effect if the given interceptor is already registered.- Parameters:
theInterceptor- The interceptor to register- Returns:
- Returns
trueif at least one valid hook method was found on this interceptor
-
unregisterInterceptor
boolean unregisterInterceptor(Object theInterceptor)
Unregister an interceptor. This method has no effect if the given interceptor is not already registered.- Parameters:
theInterceptor- The interceptor to unregister- Returns:
- Returns
trueif the interceptor was found and removed
-
registerAnonymousInterceptor
void registerAnonymousInterceptor(Pointcut thePointcut, IAnonymousInterceptor theInterceptor)
-
registerAnonymousInterceptor
void registerAnonymousInterceptor(Pointcut thePointcut, int theOrder, IAnonymousInterceptor theInterceptor)
-
getAllRegisteredInterceptors
List<Object> getAllRegisteredInterceptors()
Returns all currently registered interceptors (excluding any thread local interceptors).
-
unregisterAllInterceptors
void unregisterAllInterceptors()
Unregisters all registered interceptors. Note that this method does not unregister anythread local interceptors.
-
unregisterInterceptors
void unregisterInterceptors(@Nullable Collection<?> theInterceptors)
-
registerInterceptors
void registerInterceptors(@Nullable Collection<?> theInterceptors)
-
-