Interface ApplicationEventMulticaster
- All Known Implementing Classes:
AbstractApplicationEventMulticaster,SimpleApplicationEventMulticaster
public interface ApplicationEventMulticaster
Interface to be implemented by objects that can manage a number ofApplicationListenerobjects and publish events to them.An
ApplicationEventPublisher, typically a SpringApplicationContext, can use anApplicationEventMulticasteras a delegate for actually publishing events.- Author:
- Rod Johnson, Juergen Hoeller, Stephane Nicoll
- See Also:
ApplicationListener
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddApplicationListener(ApplicationListener<?> listener)Add a listener to be notified of all events.voidaddApplicationListenerBean(String listenerBeanName)Add a listener bean to be notified of all events.voidmulticastEvent(ApplicationEvent event)Multicast the given application event to appropriate listeners.voidmulticastEvent(ApplicationEvent event, ResolvableType eventType)Multicast the given application event to appropriate listeners.voidremoveAllListeners()Remove all listeners registered with this multicaster.voidremoveApplicationListener(ApplicationListener<?> listener)Remove a listener from the notification list.voidremoveApplicationListenerBean(String listenerBeanName)Remove a listener bean from the notification list.
Method Detail
addApplicationListener
void addApplicationListener(ApplicationListener<?> listener)
Add a listener to be notified of all events.- Parameters:
listener- the listener to add
addApplicationListenerBean
void addApplicationListenerBean(String listenerBeanName)
Add a listener bean to be notified of all events.- Parameters:
listenerBeanName- the name of the listener bean to add
removeApplicationListener
void removeApplicationListener(ApplicationListener<?> listener)
Remove a listener from the notification list.- Parameters:
listener- the listener to remove
removeApplicationListenerBean
void removeApplicationListenerBean(String listenerBeanName)
Remove a listener bean from the notification list.- Parameters:
listenerBeanName- the name of the listener bean to remove
removeAllListeners
void removeAllListeners()
Remove all listeners registered with this multicaster.After a remove call, the multicaster will perform no action on event notification until new listeners are registered.
multicastEvent
void multicastEvent(ApplicationEvent event)
Multicast the given application event to appropriate listeners.Consider using
multicastEvent(ApplicationEvent, ResolvableType)if possible as it provides better support for generics-based events.- Parameters:
event- the event to multicast
multicastEvent
void multicastEvent(ApplicationEvent event, @Nullable ResolvableType eventType)
Multicast the given application event to appropriate listeners.If the
eventTypeisnull, a default type is built based on theeventinstance.- Parameters:
event- the event to multicasteventType- the type of event (can benull)- Since:
- 4.2