b3j0f.annotation.interception module¶
Definition of annotation dedicated to intercept annotated element calls.
-
class
b3j0f.annotation.interception.
Interceptor
(interception=None, pointcut=None, enable=True, *args, **kwargs)[source]¶ Bases:
b3j0f.annotation.core.Annotation
Annotation able to intercept annotated elements.
- This interception can be disabled at any time and specialized with a
- pointcut.
-
ENABLE
= 'enable'¶ attribute name for enable the interception
-
INTERCEPTION
= 'interception'¶ interception attribute name
-
INTERCEPTOR
= '__interceptor__'¶ interceptor attribute name
-
exception
InterceptorError
[source]¶ Bases:
exceptions.Exception
Handle Interceptor errors.
-
Interceptor.
POINTCUT
= 'pointcut'¶ pointcut attribute name
-
Interceptor.
enable
¶
-
Interceptor.
interception
¶
-
Interceptor.
intercepts
(joinpoint)[source]¶ Self target interception if self is enabled
Parameters: joinpoint – advices executor
-
Interceptor.
override
¶
-
Interceptor.
pointcut
¶ Get pointcut.
-
Interceptor.
propagate
¶
-
classmethod
Interceptor.
set_enable
(target, enable=True)[source]¶ (Dis|En)able annotated interceptors.
-
Interceptor.
targets
¶
-
class
b3j0f.annotation.interception.
PrivateInterceptor
(*args, **kwargs)[source]¶ Bases:
b3j0f.annotation.interception.Interceptor
Interceptor with a private interception resource.
-
enable
¶
-
interception
¶
-
override
¶
-
propagate
¶
-
targets
¶
-
-
class
b3j0f.annotation.interception.
CallInterceptor
(*args, **kwargs)[source]¶ Bases:
b3j0f.annotation.interception.Interceptor
Interceptor dedicated to intercept call of annotated element.
Instead of Interceptor, the pointcut equals ‘__call__’, therefore, the target may be a class instead of an instance beceause python does not handle system methods (such as __call__, __repr__, etc.) if they are overriden on instance.
It could be used to intercepts annotation binding annotated by self.
-
enable
¶
-
interception
¶
-
override
¶
-
propagate
¶
-
targets
¶
-
-
class
b3j0f.annotation.interception.
PrivateCallInterceptor
(*args, **kwargs)[source]¶ Bases:
b3j0f.annotation.interception.CallInterceptor
Interceptor dedicated to apply a private interception on target calls.
Instead of Interceptor, the pointcut equals ‘__call__’, therefore, the target may be a class instead of an instance beceause python does not handle system methods (such as __call__, __repr__, etc.) if they are overriden on instance.
-
enable
¶
-
interception
¶
-
override
¶
-
propagate
¶
-
targets
¶
-