public class DelegatePerTargetObjectIntroductionInterceptor extends IntroductionInfoSupport implements IntroductionInterceptor
IntroductionInterceptor インターフェースの便利な実装。 これは DelegatingIntroductionInterceptor とは異なり、このクラスの単一インスタンスを使用して複数のターゲットオブジェクトにアドバイスを提供でき、各ターゲットオブジェクトには独自のデリゲートがあります(DelegatingIntroductionInterceptor は同じデリゲートを共有するため、すべてのターゲットで同じ状態になります)。
suppressInterface メソッドは、デリゲートクラスによって実装されたインターフェースを抑制するために使用できますが、所有している AOP プロキシに導入すべきではありません。
デリゲートが直列化できる場合、このクラスのインスタンスは直列化可能です。
メモ: このクラスと DelegatingIntroductionInterceptor の間にはいくつかの実装上の類似点があり、将来的に共通の祖先クラスを抽出するためのリファクタリングの可能性を提案しています。
IntroductionInfoSupport.suppressInterface(java.lang.Class<?>), DelegatingIntroductionInterceptor, 連載形式 publishedInterfaces| コンストラクターと説明 |
|---|
DelegatePerTargetObjectIntroductionInterceptor(java.lang.Class<?> defaultImplType, java.lang.Class<?> interfaceType) |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected java.lang.Object | doProceed(MethodInvocation mi) 提供された MethodInterceptor に進みます。 |
java.lang.Object | invoke(MethodInvocation mi) サブクラスは、アラウンドアドバイスでカスタム動作を実行する場合、これをオーバーライドする必要があります。 |
getInterfaces, implementInterfacesOnObject, implementsInterface, isMethodOnIntroducedInterface, suppressInterfaceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitimplementsInterfacepublic DelegatePerTargetObjectIntroductionInterceptor(java.lang.Class<?> defaultImplType,
java.lang.Class<?> interfaceType)@Nullable public java.lang.Object invoke(MethodInvocation mi) throws java.lang.Throwable
MethodInterceptor の invoke mi - メソッド呼び出しジョインポイント Joinpoint.proceed() の呼び出しの結果。インターセプターによってインターセプトされる可能性があります java.lang.Throwable - インターセプターまたはターゲットオブジェクトが例外をスローする場合 protected java.lang.Object doProceed(MethodInvocation mi) throws java.lang.Throwable
MethodInterceptor を続行します。サブクラスは、このメソッドをオーバーライドして、ターゲットオブジェクトでのメソッド呼び出しをインターセプトできます。これは、イントロダクションが導入されるオブジェクトを監視する必要がある場合に役立ちます。このメソッドは、導入されたインターフェースの MethodInvocations に対して呼び出されることはありません。java.lang.Throwable