Class GenericApplicationListenerAdapter
java.lang.Object
org.springframework.context.event.GenericApplicationListenerAdapter
- All Implemented Interfaces:
EventListener, ApplicationListener<ApplicationEvent>, GenericApplicationListener, SmartApplicationListener, Ordered
GenericApplicationListener adapter that determines supported event types
through introspecting the generically declared type of the target listener.- Since:
- 3.0
- Author:
- Juergen Hoeller, Stephane Nicoll
- See Also:
-
Field Summary
Fields inherited from interface Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionGenericApplicationListenerAdapter(ApplicationListener<?> delegate) Create a new GenericApplicationListener for the given delegate. -
Method Summary
Modifier and TypeMethodDescriptionReturn an optional identifier for the listener.intgetOrder()Determine this listener's order in a set of listeners for the same event.voidHandle an application event.booleansupportsEventType(ResolvableType eventType) Determine whether this listener actually supports the given event type.booleansupportsSourceType(@Nullable Class<?> sourceType) Determine whether this listener actually supports the given source type.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ApplicationListener
supportsAsyncExecutionMethods inherited from interface GenericApplicationListener
supportsEventType
-
Constructor Details
-
GenericApplicationListenerAdapter
Create a new GenericApplicationListener for the given delegate.- Parameters:
delegate- the delegate listener to be invoked
-
-
Method Details
-
onApplicationEvent
Description copied from interface:ApplicationListenerHandle an application event.- Specified by:
onApplicationEventin interfaceApplicationListener<ApplicationEvent>- Parameters:
event- the event to respond to
-
supportsEventType
Description copied from interface:GenericApplicationListenerDetermine whether this listener actually supports the given event type.- Specified by:
supportsEventTypein interfaceGenericApplicationListener- Parameters:
eventType- the event type (nevernull)
-
supportsSourceType
Description copied from interface:SmartApplicationListenerDetermine whether this listener actually supports the given source type.The default implementation always returns
true.- Specified by:
supportsSourceTypein interfaceSmartApplicationListener- Parameters:
sourceType- the source type, ornullif no source
-
getOrder
public int getOrder()Description copied from interface:SmartApplicationListenerDetermine this listener's order in a set of listeners for the same event.The default implementation returns
Ordered.LOWEST_PRECEDENCE.- Specified by:
getOrderin interfaceOrdered- Specified by:
getOrderin interfaceSmartApplicationListener- Returns:
- the order value
- See Also:
-
getListenerId
Description copied from interface:SmartApplicationListenerReturn an optional identifier for the listener.The default value is an empty String.
- Specified by:
getListenerIdin interfaceSmartApplicationListener- See Also:
-