Annotation Interface Adapter


An Adapter is advice applicable to a method that will create an entirely new bean definition that delegates to the annotated method.

Typically used in conjunction with an interface or class that provides a "Single Abstract Method" (or SAM) type.

An example of usage could be to introduce a ApplicationEventListener:

For example:


  @Adapter(ApplicationEventListener)
   public void onStartup(StartupEvent startupEvent) {
   }
 

The above example will create a new bean that delegates to the onStartup method that is an instance of ApplicationEventListener. The generic types are aligned and populated from the types defined in the method signature

This annotation can be used as a stereotype annotation. If for some reason the generated class cannot delegate to the method then a compilation error should occur.

Since:
1.0
Author:
graemerocher
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Internal attributes for the adapter annotation.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The target interface to adapt.
  • Element Details

    • value

      Class<?> value
      The target interface to adapt.
      Returns:
      An interface to adapt