Class AnnotationEventListenerResolver
java.lang.Object
org.apache.shiro.event.support.AnnotationEventListenerResolver
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClass<? extends Annotation> Returns the type of annotation that indicates a method that should be represented as anEventListener, defaults toSubscribe.getEventListeners(Object instance) Returns a new collection ofEventListenerinstances, each instance corresponding to an annotated method discovered on the specifiedinstanceargument.voidsetAnnotationClass(Class<? extends Annotation> annotationClass) Sets the type of annotation that indicates a method that should be represented as anEventListener.
-
Constructor Details
-
AnnotationEventListenerResolver
public AnnotationEventListenerResolver()
-
-
Method Details
-
getEventListeners
Returns a new collection ofEventListenerinstances, each instance corresponding to an annotated method discovered on the specifiedinstanceargument.- Specified by:
getEventListenersin interfaceEventListenerResolver- Parameters:
instance- the instance to inspect for annotated event handler methods.- Returns:
- a new collection of
EventListenerinstances, each instance corresponding to an annotated method discovered on the specifiedinstanceargument.
-
getAnnotationClass
Returns the type of annotation that indicates a method that should be represented as anEventListener, defaults toSubscribe.- Returns:
- the type of annotation that indicates a method that should be represented as an
EventListener, defaults toSubscribe.
-
setAnnotationClass
Sets the type of annotation that indicates a method that should be represented as anEventListener. The default value isSubscribe.- Parameters:
annotationClass- the type of annotation that indicates a method that should be represented as anEventListener. The default value isSubscribe.
-