Annotation Interface Interception.Delegate

Enclosing class:
Interception

@Documented @Retention(CLASS) @Target(TYPE) public static @interface Interception.Delegate
Use this annotation to mark a class ready for interception delegation. The delegates are code generated automatically if a service factory (such as a Supplier) provides an instance of a class (or provides an interface implementation) that has methods annotated with interception trigger(s).

Classes are by default not good candidates for interception, so they MUST be annotated either with this annotation, or referenced via Interception.ExternalDelegate.

Implementing a delegate for a class introduces several problems, the biggest one being construction side-effects.

If you want delegation for classes to support interception:

  • The class must have accessible no-arg constructor (at least package local)
  • The constructor should have no side effects, as the instance will act only as a wrapper for the delegate
  • All invoked methods must be accessible (at least package local)