Class AnnotationEventListenerResolver

java.lang.Object
org.apache.shiro.event.support.AnnotationEventListenerResolver
All Implemented Interfaces:
EventListenerResolver

public class AnnotationEventListenerResolver extends Object implements EventListenerResolver
Inspects an object for annotated methods of interest and creates an EventListener instance for each method discovered. An event bus will call the resulting listeners as relevant events arrive.

The default annotationClass is Subscribe, indicating each Subscribe-annotated method will be represented as an EventListener.

Since:
1.3
See Also:
  • Constructor Details

    • AnnotationEventListenerResolver

      public AnnotationEventListenerResolver()
  • Method Details

    • getEventListeners

      public List<EventListener> getEventListeners(Object instance)
      Returns a new collection of EventListener instances, each instance corresponding to an annotated method discovered on the specified instance argument.
      Specified by:
      getEventListeners in interface EventListenerResolver
      Parameters:
      instance - the instance to inspect for annotated event handler methods.
      Returns:
      a new collection of EventListener instances, each instance corresponding to an annotated method discovered on the specified instance argument.
    • getAnnotationClass

      public Class<? extends Annotation> getAnnotationClass()
      Returns the type of annotation that indicates a method that should be represented as an EventListener, defaults to Subscribe.
      Returns:
      the type of annotation that indicates a method that should be represented as an EventListener, defaults to Subscribe.
    • setAnnotationClass

      public void setAnnotationClass(Class<? extends Annotation> annotationClass)
      Sets the type of annotation that indicates a method that should be represented as an EventListener. The default value is Subscribe.
      Parameters:
      annotationClass - the type of annotation that indicates a method that should be represented as an EventListener. The default value is Subscribe.