public static final class Interceptor.Factory
extends java.lang.Object
InterceptorアノテーションによるHandler.handle(Object, ExecutionContext)
 へのインターセプトを実現するスタティックメソッドを保持するクラス。
 
 次のコードにより、handler.handle() メソッド上に付与されている
 Interceptorアノテーションを収集し、各インターセプタに対応した
 リクエストハンドラでラップされたハンドラ(wrapped)が生成される。
 
     Handler wrapped = Interceptor.Factory.wrap(handler);
 
 wrapped.handle() を実行すると、各インターセプタのhandle()メソッドが順次実行され、
 最後に元のリクエストハンドラのhandle()メソッドが呼ばれる。
 
 インターセプタの実行順は、SystemRepositoryにキー値:interceptorsOrderで定義する。
 
 以下のように定義した場合、インターセプタはInterceptor2、Interceptor1の順で実行される。
 
 
 <list name="interceptorsOrder">
   <value>test.Interceptor2</value>
   <value>test.Interceptor1</value>
 </list>
 
 SystemRepositoryに実行順が定義されている場合に、実行順に定義されていないインターセプタを
 使用すると、実行時例外(IllegalArgumentException)を送出し処理を終了する。
 SystemRepositoryに実行順が定義されていない場合は、
 Method.getDeclaredAnnotations()で返されるリストの逆順で実行される。
 ※Method.getDeclaredAnnotations()で返される順序は、規定されていないため実行環境(jvmのバージョンなど)により結果が変わる可能性がある。
 このため、実行順を保証する必要がある場合は、必ずSystemRepositoryに実行順の定義を行うこと。| 修飾子とタイプ | メソッドと説明 | 
|---|---|
static Interceptor | 
getInterceptorOf(java.lang.annotation.Annotation annotation)
与えられたアノテーションに付与されている
  
Interceptorメタアノテーションを返す。 | 
static <D,R> Handler<D,R> | 
wrap(Handler<D,R> handler)
Interceptorアノテーションによるリクエストハンドラの
 ラッパーを作成する。 | 
static <D,R> Handler<D,R> | 
wrap(Handler<D,R> handler,
    java.lang.annotation.Annotation[] annotations)
与えられた 
Interceptorアノテーションによって
 リクエストハンドラをラップする。 | 
public static <D,R> Handler<D,R> wrap(Handler<D,R> handler)
Interceptorアノテーションによるリクエストハンドラの
 ラッパーを作成する。
 
 与えられたリクエストハンドラのHandler.handle(Object, ExecutionContext) メソッド上に付与された
 Interceptorアノテーションを取得し、
 その内容に準じた処理をリクエストハンドラに追加したラッパーで作成する。D - ハンドラの入力データ型R - ハンドラの処理結果データ型handler - ラップされるハンドラInterceptorの処理を追加したリクエストハンドラpublic static <D,R> Handler<D,R> wrap(Handler<D,R> handler, java.lang.annotation.Annotation[] annotations)
Interceptorアノテーションによって
 リクエストハンドラをラップする。
 
 ただし、リクエストハンドラのHandler.handle(Object, ExecutionContext)
 メソッドに付与されたアノテーションについては評価しない。D - ハンドラの入力データ型R - ハンドラの処理結果データ型handler - ハンドラannotations - InterceptorアノテーションInterceptorでラップされたリクエストハンドラpublic static Interceptor getInterceptorOf(java.lang.annotation.Annotation annotation)
Interceptorメタアノテーションを返す。annotation - メタアノテーションInterceptorアノテーション。
         Interceptorが付与されていない場合はnull。