类 SourceFilteringListener
java.lang.Object
cn.taketoday.context.event.SourceFilteringListener
- 所有已实现的接口:
ApplicationListener<ApplicationEvent>,GenericApplicationListener,SmartApplicationListener,cn.taketoday.core.Ordered,EventListener
ApplicationListener decorator that filters
events from a specified event source, invoking its delegate listener for
matching ApplicationEvent objects only.
Can also be used as base class, overriding the onApplicationEventInternal(cn.taketoday.context.ApplicationEvent)
method instead of specifying a delegate listener.
- 从以下版本开始:
- 4.0 2022/5/27 15:47
- 作者:
- Juergen Hoeller, Stephane Nicoll, Harry Yang
-
字段概要
从接口继承的字段 cn.taketoday.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
构造器概要
构造器限定符构造器说明protectedSourceFilteringListener(Object source) Create a SourceFilteringListener for the given event source, expecting subclasses to override theonApplicationEventInternal(cn.taketoday.context.ApplicationEvent)method (instead of specifying a delegate listener).SourceFilteringListener(Object source, ApplicationListener<?> delegate) Create a SourceFilteringListener for the given event source. -
方法概要
修饰符和类型方法说明Return 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.protected voidActually process the event, after having filtered according to the desired event source already.booleansupportsEventType(cn.taketoday.core.ResolvableType eventType) Determine whether this listener actually supports the given event type.booleansupportsSourceType(Class<?> sourceType) Determine whether this listener actually supports the given source type.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.context.event.GenericApplicationListener
supportsEventType
-
构造器详细资料
-
SourceFilteringListener
Create a SourceFilteringListener for the given event source.- 参数:
source- the event source that this listener filters for, only processing events from this sourcedelegate- the delegate listener to invoke with event from the specified source
-
SourceFilteringListener
Create a SourceFilteringListener for the given event source, expecting subclasses to override theonApplicationEventInternal(cn.taketoday.context.ApplicationEvent)method (instead of specifying a delegate listener).- 参数:
source- the event source that this listener filters for, only processing events from this source
-
-
方法详细资料
-
onApplicationEvent
从接口复制的说明:ApplicationListenerHandle an application event.- 指定者:
onApplicationEvent在接口中ApplicationListener<ApplicationEvent>- 参数:
event- the event to respond to
-
supportsEventType
public boolean supportsEventType(cn.taketoday.core.ResolvableType eventType) 从接口复制的说明:GenericApplicationListenerDetermine whether this listener actually supports the given event type.- 指定者:
supportsEventType在接口中GenericApplicationListener- 参数:
eventType- the event type (nevernull)
-
supportsSourceType
从接口复制的说明:SmartApplicationListenerDetermine whether this listener actually supports the given source type.The default implementation always returns
true.- 指定者:
supportsSourceType在接口中SmartApplicationListener- 参数:
sourceType- the source type, ornullif no source
-
getOrder
public int getOrder()从接口复制的说明:SmartApplicationListenerDetermine this listener's order in a set of listeners for the same event.The default implementation returns
Ordered.LOWEST_PRECEDENCE.- 指定者:
getOrder在接口中cn.taketoday.core.Ordered- 指定者:
getOrder在接口中SmartApplicationListener
-
getListenerId
从接口复制的说明:SmartApplicationListenerReturn an optional identifier for the listener.The default value is an empty String.
-
onApplicationEventInternal
Actually process the event, after having filtered according to the desired event source already.The default implementation invokes the specified delegate, if any.
- 参数:
event- the event to process (matching the specified source)
-