Annotation Interface Interception
@Documented
@Target(ANNOTATION_TYPE)
@Retention(RUNTIME)
@Analyze("org.tentackle.buildsupport.InterceptionAnalyzeHandler")
public @interface Interception
Annotation to mark another annotation as an interception.
There are 4 different ways to assign the implementation:
- by class (
implementedBy=...): direct reference to the implementing class. - by class name (
implementedByName=...): the name of the implementing class. Avoids the dependency to the class, but may be prone to typos. - by service name (
implementedByService=...): the implementing class must be annotated with @ServiceNameand both names must match. Again, this may be prone to typos, but avoids dependency. - by service class: if none of the above is given, the implementation must be annotated with
@
Servicereferencing the interception annotation.
Interceptors declared in an interface (public) are invoked before those declared in the implementation (hidden). Within each group, the order follows the order of the annotations.
The optional type parameter defines the visibility of the interception:
- ALL: no restrictions. This is the default.
- PUBLIC: interface only, i.e. part of the model.
- HIDDEN: classes only, i.e. not visible in the model interfaces.
Annotation processors verify at compile-time, that the interceptors
are applied to the proper methods and/or classes according to the type parameter:
AllInterceptorAnnotationProcessor: verifies that the annotated method belongs to anInterceptablesuch asDomainObject,PersistentObjector some of their implementations.PublicInterceptorAnnotationProcessor: same as above, but only for declared methods in interfaces.HiddenInterceptorAnnotationProcessor: same as above, but only for implementing methods.
- Author:
- harald
-
Nested Class Summary
Nested Classes -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<? extends Interceptor> Defines the interceptor implementation by class.Defines the interceptor implementation by its classname.
Avoids the concrete dependency.Defines the interceptor implementation by a service name.
Avoids the concrete dependency.Defines the interceptor type.
-
Element Details
-
implementedBy
Class<? extends Interceptor> implementedByDefines the interceptor implementation by class.- Returns:
- the interceptor implementing the interception.
- Default:
org.tentackle.reflect.Interceptor.class
-
implementedByName
String implementedByNameDefines the interceptor implementation by its classname.
Avoids the concrete dependency.- Returns:
- the interceptor implementing the interception.
- Default:
""
-
implementedByService
String implementedByServiceDefines the interceptor implementation by a service name.
Avoids the concrete dependency.- Returns:
- the interceptor implementing the interception.
- Default:
""
-
type
Interception.Type typeDefines the interceptor type.- Returns:
- PUBLIC, HIDDEN or ALL (default)
- Default:
ALL
-