接口 ApplicationEventMulticaster
public interface ApplicationEventMulticaster
Interface to be implemented by objects that can manage a number of
ApplicationListener objects and publish events to them.
An ApplicationEventPublisher, typically
a Framework ApplicationContext, can use an
ApplicationEventMulticaster as a delegate for actually publishing events.
- 从以下版本开始:
- 4.0 2021/12/8 15:18
- 作者:
- Rod Johnson, Juergen Hoeller, Stephane Nicoll, Harry Yang
- 另请参阅:
-
方法概要
修饰符和类型方法说明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, cn.taketoday.core.ResolvableType eventType) Multicast the given application event to appropriate listeners.voidRemove 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.voidremoveApplicationListenerBeans(Predicate<String> predicate) Remove all matching listener beans from the set of registered listener bean names (referring to bean classes which in turn implement theApplicationListenerinterface directly).voidremoveApplicationListeners(Predicate<ApplicationListener<?>> predicate) Remove all matching listeners from the set of registeredApplicationListenerinstances (which includes adapter classes such asApplicationListenerMethodAdapter, e.g. for annotatedEventListenermethods).
-
方法详细资料
-
addApplicationListener
Add a listener to be notified of all events.- 参数:
listener- the listener to add- 另请参阅:
-
addApplicationListenerBean
Add a listener bean to be notified of all events.- 参数:
listenerBeanName- the name of the listener bean to add- 另请参阅:
-
removeApplicationListener
Remove a listener from the notification list.- 参数:
listener- the listener to remove- 另请参阅:
-
removeApplicationListenerBean
Remove a listener bean from the notification list.- 参数:
listenerBeanName- the name of the listener bean to remove- 另请参阅:
-
removeApplicationListeners
Remove all matching listeners from the set of registeredApplicationListenerinstances (which includes adapter classes such asApplicationListenerMethodAdapter, e.g. for annotatedEventListenermethods).Note: This just applies to instance registrations, not to listeners registered by bean name.
- 参数:
predicate- the predicate to identify listener instances to remove, e.g. checkingSmartApplicationListener.getListenerId()- 另请参阅:
-
removeApplicationListenerBeans
Remove all matching listener beans from the set of registered listener bean names (referring to bean classes which in turn implement theApplicationListenerinterface directly).Note: This just applies to bean name registrations, not to programmatically registered
ApplicationListenerinstances.- 参数:
predicate- the predicate to identify listener bean names 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
Multicast the given application event to appropriate listeners.Consider using
multicastEvent(ApplicationEvent, ResolvableType)if possible as it provides better support for generics-based events.- 参数:
event- the event to multicast
-
multicastEvent
Multicast the given application event to appropriate listeners.If the
eventTypeisnull, a default type is built based on theeventinstance.- 参数:
event- the event to multicasteventType- the type of event (can benull)
-