インターフェース GenericApplicationListener
- すべてのスーパーインターフェース:
ApplicationListener<ApplicationEvent>
、EventListenerSE
、Ordered
、SmartApplicationListener
- すべての既知の実装クラス:
ApplicationListenerMethodAdapter
、GenericApplicationListenerAdapter
、SourceFilteringListener
、TransactionalApplicationListenerMethodAdapter
標準の
ApplicationListener
インターフェースの拡張バリアント。サポートされているイベントやソース型などのメタデータをさらに公開します。Spring Framework 4.2 の時点で、このインターフェースはクラスベースの SmartApplicationListener
に取って代わり、一般的なイベント型を完全に処理します。5.3.5 では、正式に SmartApplicationListener
を継承し、デフォルトの方法で supportsEventType(Class)
を supportsEventType(ResolvableType)
に適合させています。
- 導入:
- 4.2
- 作成者:
- Stephane Nicoll, Juergen Hoeller
- 関連事項:
フィールドサマリー
インターフェース org.springframework.core.Ordered から継承されたフィールド
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
方法の概要
修飾子と型メソッド説明static <E extends ApplicationEvent>
GenericApplicationListenerforEventType
(ClassSE<E> eventType, ConsumerSE<E> consumer) 指定されたイベント型に対して新しいApplicationListener
を作成します。default boolean
supportsEventType
(ClassSE<? extends ApplicationEvent> eventType) boolean
supportsEventType
(ResolvableType eventType) このリスナーが特定のイベント型を実際にサポートしているかどうかを判断します。インターフェース org.springframework.context.ApplicationListener から継承されたメソッド
onApplicationEvent, supportsAsyncExecution
インターフェース org.springframework.context.event.SmartApplicationListener から継承されたメソッド
getListenerId, getOrder, supportsSourceType
メソッドの詳細
supportsEventType
SmartApplicationListener.supportsEventType(Class)
をsupportsEventType(ResolvableType)
への委譲でオーバーライドします。- 次で指定:
- インターフェース
SmartApplicationListener
のsupportsEventType
- パラメーター:
eventType
- イベント型 (非null
)
supportsEventType
このリスナーが特定のイベント型を実際にサポートしているかどうかを判断します。- パラメーター:
eventType
- イベント型 (非null
)
forEventType
static <E extends ApplicationEvent> GenericApplicationListener forEventType(ClassSE<E> eventType, ConsumerSE<E> consumer) 指定されたイベント型に対して新しいApplicationListener
を作成します。- 型パラメーター:
E
- 待機する特定のApplicationEvent
サブクラス- パラメーター:
eventType
- 聴くイベントconsumer
- 一致するイベントが発生したときに呼び出すコンシューマー- 戻り値:
- 対応する
ApplicationListener
インスタンス - 導入:
- 6.1.3