Package nablarch.fw
Annotation Interface Interceptor
@Documented
@Target(ANNOTATION_TYPE)
@Retention(RUNTIME)
@Published(tag="architect")
public @interface Interceptor
Handler.handle(Object, ExecutionContext)メソッドに対するインターセプタに付与する
メタアノテーション。
インターセプタを作成するには、このメタアノテーションを付与したアノテーションを作成し、
Interceptorの属性には、インターセプト処理を実装するクラスを指定する。
この実装クラスは、Interceptor.Impl を継承して作成する。
以下は、インターセプタ"@AroundAdvice"の実装例である。
@Target(ElementType.METHOD)@Retention(RetentionPolicy.RUNTIME)@Interceptor(AroundAdvice.Impl.class) public@interfaceAroundAdvice { public static class Impl extends Interceptor.Impl<HttpRequest, HttpResponse, AroundAdvice> { public HttpResponse handle(HttpRequest req, ExecutionContext ctx) { doBeforeAdvice(req, ctx); HttpResponse res = getOriginalHandler().handle(req, ctx); doAfterAdvice(req, ctx); return res; } void doBeforeAdvice(HttpRequest req, ExecutionContext ctx) { //...... } void doAfterAdvice(HttpRequest req, ExecutionContext ctx) { //...... } } }
- Author:
- Iwauo Tajima <iwauo@tis.co.jp>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classInterceptorアノテーションによるHandler.handle(Object, ExecutionContext)へのインターセプトを実現するスタティックメソッドを保持するクラス。static classInterceptor.Impl<TData,TResult, T extends Annotation> Interceptorの処理内容を実装するクラスの抽象基底クラスとなるリクエストハンドラ。 -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionClass<? extends Interceptor.Impl>このインターセプタが付与されたメソッドに対して実行される インターセプト処理を実装するクラス。
-
Element Details
-
value
Class<? extends Interceptor.Impl> valueこのインターセプタが付与されたメソッドに対して実行される インターセプト処理を実装するクラス。- See Also:
-