Class GenericApplicationListenerAdapter
- java.lang.Object
- org.springframework.context.event.GenericApplicationListenerAdapter
- All Implemented Interfaces:
EventListener
,ApplicationListener<ApplicationEvent>
,GenericApplicationListener
,SmartApplicationListener
,Ordered
public class GenericApplicationListenerAdapter extends Object implements GenericApplicationListener, SmartApplicationListener
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:
ApplicationListener.onApplicationEvent(E)
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor Summary
Constructors Constructor Description GenericApplicationListenerAdapter(ApplicationListener<?> delegate)
Create a new GenericApplicationListener for the given delegate.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getOrder()
Get the order value of this object.void
onApplicationEvent(ApplicationEvent event)
Handle an application event.boolean
supportsEventType(Class<? extends ApplicationEvent> eventType)
Determine whether this listener actually supports the given event type.boolean
supportsEventType(ResolvableType eventType)
Determine whether this listener actually supports the given event type.boolean
supportsSourceType(Class<?> sourceType)
Determine whether this listener actually supports the given source type.
Constructor Detail
GenericApplicationListenerAdapter
public GenericApplicationListenerAdapter(ApplicationListener<?> delegate)
Create a new GenericApplicationListener for the given delegate.- Parameters:
delegate
- the delegate listener to be invoked
Method Detail
onApplicationEvent
public void onApplicationEvent(ApplicationEvent event)
Description copied from interface:ApplicationListener
Handle an application event.- Specified by:
onApplicationEvent
in interfaceApplicationListener<ApplicationEvent>
- Parameters:
event
- the event to respond to
supportsEventType
public boolean supportsEventType(ResolvableType eventType)
Description copied from interface:GenericApplicationListener
Determine whether this listener actually supports the given event type.- Specified by:
supportsEventType
in interfaceGenericApplicationListener
- Parameters:
eventType
- the event type (nevernull
)
supportsEventType
public boolean supportsEventType(Class<? extends ApplicationEvent> eventType)
Description copied from interface:SmartApplicationListener
Determine whether this listener actually supports the given event type.- Specified by:
supportsEventType
in interfaceSmartApplicationListener
- Parameters:
eventType
- the event type (nevernull
)
supportsSourceType
public boolean supportsSourceType(Class<?> sourceType)
Description copied from interface:GenericApplicationListener
Determine whether this listener actually supports the given source type.- Specified by:
supportsSourceType
in interfaceGenericApplicationListener
- Specified by:
supportsSourceType
in interfaceSmartApplicationListener
- Parameters:
sourceType
- the source type, ornull
if no source
getOrder
public int getOrder()
Description copied from interface:Ordered
Get the order value of this object.Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet
load-on-startup
values).Same order values will result in arbitrary sort positions for the affected objects.
- Specified by:
getOrder
in interfaceOrdered
- Returns:
- the order value
- See Also:
Ordered.HIGHEST_PRECEDENCE
,Ordered.LOWEST_PRECEDENCE