Interface GenericApplicationListener
- All Superinterfaces:
ApplicationListener<ApplicationEvent>
,EventListener
,Ordered
- All Known Implementing Classes:
ApplicationListenerMethodAdapter
,GenericApplicationListenerAdapter
,SourceFilteringListener
public interface GenericApplicationListener extends ApplicationListener<ApplicationEvent>, Ordered
Extended variant of the standardApplicationListener
interface, exposing further metadata such as the supported event and source type.As of Spring Framework 4.2, this interface supersedes the Class-based
SmartApplicationListener
with full handling of generic event types.- Since:
- 4.2
- Author:
- Stephane Nicoll
- See Also:
SmartApplicationListener
,GenericApplicationListenerAdapter
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
getOrder()
Determine this listener's order in a set of listeners for the same event.boolean
supportsEventType(ResolvableType eventType)
Determine whether this listener actually supports the given event type.default boolean
supportsSourceType(Class<?> sourceType)
Determine whether this listener actually supports the given source type.Methods inherited from interface org.springframework.context.ApplicationListener
onApplicationEvent
Method Detail
supportsEventType
boolean supportsEventType(ResolvableType eventType)
Determine whether this listener actually supports the given event type.- Parameters:
eventType
- the event type (nevernull
)
supportsSourceType
default boolean supportsSourceType(@Nullable Class<?> sourceType)
Determine whether this listener actually supports the given source type.The default implementation always returns
true
.- Parameters:
sourceType
- the source type, ornull
if no source
getOrder
default int getOrder()
Determine this listener's order in a set of listeners for the same event.The default implementation returns
Ordered.LOWEST_PRECEDENCE
.- Specified by:
getOrder
in interfaceOrdered
- Returns:
- the order value
- See Also:
Ordered.HIGHEST_PRECEDENCE
,Ordered.LOWEST_PRECEDENCE