Interface PluginAnnotationProcessor<R>

Type Parameters:
R - the result type of the processor
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PluginAnnotationProcessor<R>
A centralized mechanism for processing annotations of plugin objects.
  • Method Details

    • events

      Processes the EventHandler method annotations of a given object to create event listeners. The result is an EventSubscription tied to all created event listeners. If none, an empty result is returned.
      This processor supports the Async annotation. Event handler methods will be executed asynchronously if present.
      Parameters:
      plugin - the owning plugin
      Returns:
      a new event handler processor
    • tasks

      Processes the TaskHandler method annotations of a given object to create tasks. The result is a Cancellable tied to all created tasks. If none, an empty result is returned.
      This processor supports the Async annotation. Task handler methods will be executed asynchronously if present.
      Parameters:
      plugin - the owning plugin
      Returns:
      a new task handler processor
    • compose

      static PluginAnnotationProcessor<List<Object>> compose(PluginAnnotationProcessor<?>... processors)
      Composes multiple processors into one that returns their result in a list.
      Note that if a composed processor is in the list of processors, it will be flattened. Such as:
      compose(p1, p2, compose(p3, p4), p5) will become compose(p1, p2, p3, p4, p5)
      Parameters:
      processors - the processors
      Returns:
      the composed processor
    • compose

      Composes multiple processors into one that returns their result in a list.
      Note that if a composed processor is in the list of processors, it will be flattened. Such as:
      compose(p1, p2, compose(p3, p4), p5) will become compose(p1, p2, p3, p4, p5)
      Parameters:
      processors - the processors
      Returns:
      the composed processor
    • process

      Optional<R> process(Object instance)
      Processes the annotations of the given object.
      Parameters:
      instance - the object
      Returns:
      the result of the processing