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