public class ApplicationListenerMethodAdapter extends ObjectSE implements GenericApplicationListener
EventListener
アノテーション付きメソッドに委譲する GenericApplicationListener
アダプター。 サブクラスにデフォルトから逸脱する機会を与えるために processEvent(ApplicationEvent)
に委譲します。必要に応じて PayloadApplicationEvent
のコンテンツをアンラップして、メソッド宣言で任意のイベント型を定義できるようにします。条件が定義されている場合、基礎となるメソッドを呼び出す前に評価されます。
修飾子と型 | フィールドと説明 |
---|---|
protected Log | logger |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
コンストラクターと説明 |
---|
ApplicationListenerMethodAdapter(StringSE beanName, ClassSE<?> targetClass, MethodSE method) 新しい ApplicationListenerMethodAdapter を作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
protected ObjectSE | doInvoke(ObjectSE... args) 指定された引数値を使用してイベントリスナーメソッドを呼び出します。 |
protected StringSE | getCondition() 使用する条件を返します。 |
protected StringSE | getDefaultListenerId() annotation-specified id value がない場合に適用される、ターゲットリスナーのデフォルト ID を決定します。 |
protected StringSE | getDetailedErrorMessage(ObjectSE bean, StringSE message) 指定されたエラーメッセージに、Bean 型やメソッドシグネチャーなどの詳細を追加します。 |
StringSE | getListenerId() リスナーのオプションの識別子を返します。 |
int | getOrder() 同じイベントの一連のリスナーで、このリスナーの順序を決定します。 |
protected ObjectSE | getTargetBean() 使用するターゲット Bean インスタンスを返します。 |
protected MethodSE | getTargetMethod() ターゲットリスナーメソッドを返します。 |
protected void | handleAsyncError(ThrowableSE t) |
protected void | handleResult(ObjectSE result) |
void | onApplicationEvent(ApplicationEvent event) アプリケーションイベントを処理します。 |
void | processEvent(ApplicationEvent event) 指定された ApplicationEvent を処理し、条件が一致するかどうかを確認し、null 以外の結果があればそれを処理します。 |
protected ObjectSE[] | resolveArguments(ApplicationEvent event) 指定された ApplicationEvent に使用するメソッド引数を解決します。 |
boolean | supportsEventType(ResolvableType eventType) このリスナーが特定のイベント型を実際にサポートしているかどうかを判断します。 |
boolean | supportsSourceType(ClassSE<?> sourceType) このリスナーが特定のソース型を実際にサポートしているかどうかを判断します。 |
StringSE | toString() |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
supportsEventType
forPayload
protected final Log logger
public void onApplicationEvent(ApplicationEvent event)
ApplicationListener
ApplicationListener<ApplicationEvent>
の onApplicationEvent
event
- 応答するイベント public boolean supportsEventType(ResolvableType eventType)
GenericApplicationListener
GenericApplicationListener
の supportsEventType
eventType
- イベント型 (非 null
)public boolean supportsSourceType(@Nullable ClassSE<?> sourceType)
SmartApplicationListener
デフォルトの実装は、常に true
を返します。
SmartApplicationListener
の supportsSourceType
sourceType
- ソース型、またはソースがない場合は null
public int getOrder()
SmartApplicationListener
デフォルトの実装は Ordered.LOWEST_PRECEDENCE
を返します。
SmartApplicationListener
の getOrder
Ordered
の getOrder
Ordered.HIGHEST_PRECEDENCE
, Ordered.LOWEST_PRECEDENCE
public StringSE getListenerId()
SmartApplicationListener
デフォルト値は空の文字列です。
protected StringSE getDefaultListenerId()
annotation-specified id value
がない場合に適用される、ターゲットリスナーのデフォルト ID を決定します。デフォルトの実装では、パラメーター型を使用してメソッド名を作成します。
getListenerId()
public void processEvent(ApplicationEvent event)
ApplicationEvent
を処理し、条件が一致するかどうかを確認し、null 以外の結果があればそれを処理します。@Nullable protected ObjectSE[] resolveArguments(ApplicationEvent event)
ApplicationEvent
に使用するメソッド引数を解決します。 これらの引数は、このインスタンスによって処理されるメソッドを呼び出すために使用されます。null
を返して、適切な引数を解決できなかったことを示すことができます。指定されたイベントに対してメソッドをまったく呼び出さないでください。
protected void handleResult(ObjectSE result)
protected void handleAsyncError(ThrowableSE t)
protected ObjectSE getTargetBean()
protected MethodSE getTargetMethod()
@Nullable protected StringSE getCondition()
EventListener
アノテーションの condition
属性、または @EventListener
でメタアノテーションが付けられた構成済みアノテーションの一致する属性に一致します。
protected StringSE getDetailedErrorMessage(ObjectSE bean, StringSE message)
message
- HandlerMethod の詳細を追加するエラーメッセージ public StringSE toString()
ObjectSE
の toStringSE