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:

  1. by class (implementedBy=...): direct reference to the implementing class.
  2. by class name (implementedByName=...): the name of the implementing class. Avoids the dependency to the class, but may be prone to typos.
  3. by service name (implementedByService=...): the implementing class must be annotated with @ServiceName and both names must match. Again, this may be prone to typos, but avoids dependency.
  4. by service class: same as option 3, but the implementation must be annotated with @Service, referencing the interception annotation.

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 an Interceptable such as DomainObject, PersistentObject or 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
    Modifier and Type
    Class
    Description
    static enum 
    the interceptor type.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? 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 servicename.
    Avoids the concrete dependency.
    Defines the interceptor type.
  • Element Details

    • implementedBy

      Class<? extends Interceptor> implementedBy
      Defines the interceptor implementation by class.
      Returns:
      the interceptor implementing the interception.
      Default:
      org.tentackle.reflect.Interceptor.class
    • implementedByName

      String implementedByName
      Defines the interceptor implementation by its classname.
      Avoids the concrete dependency.
      Returns:
      the interceptor implementing the interception.
      Default:
      ""
    • implementedByService

      String implementedByService
      Defines the interceptor implementation by a servicename.
      Avoids the concrete dependency.
      Returns:
      the interceptor implementing the interception.
      Default:
      ""
    • type

      Defines the interceptor type.
      Returns:
      PUBLIC, HIDDEN or ALL (default)
      Default:
      ALL