org.seasar.aptina.unit
クラス PrintingProcessor

java.lang.Object
  上位を拡張 javax.annotation.processing.AbstractProcessor
      上位を拡張 org.seasar.aptina.unit.PrintingProcessor
すべての実装されたインタフェース:
Processor

@SupportedSourceVersion(value=RELEASE_6)
@SupportedAnnotationTypes(value="*")
public class PrintingProcessor
extends AbstractProcessor

コンパイル対象の Element 階層をコンソールに出力する Processor です.

AptinaTestCase のサブクラスで, AptinaTestCase.addProcessor(Processor...) にこのクラスを加えることで, コンパイル対象の Element 階層を確認することができます.

次のサンプルは, src/test/java フォルダにある TestSource.java をコンパイルし, PrintingProcessorElement 階層をコンソールに出力するテストクラスです.

 public class XxxProcessorTest extends AptinaTestCase {

     @Override
     protected void setUp() throws Exception {
         super.setUp();
         // ソースパスを追加
         addSourcePath("src/test/java");
     }

     public void test() throws Exception {
         // PrintingProcessor を生成して追加
         addProcessor(new PrintingProcessor());

         // コンパイル対象を追加
         addCompilationUnit(TestSource.class);

         // コンパイル実行
         compile();
     }
 }
 

作成者:
koichik

フィールドの概要
protected  int depth
          階層の深さ
protected  PrintWriter out
          出力先
protected static char[] SPACES
          インデント用の空白 (100 文字)
 
クラス javax.annotation.processing.AbstractProcessor から継承されたフィールド
processingEnv
 
コンストラクタの概要
PrintingProcessor()
          インスタンスを構築します.
PrintingProcessor(PrintWriter out)
          インスタンスを構築します.
 
メソッドの概要
protected  void indent(int depth)
          インデントを出力します.
protected  void printEnterMessage(Element e)
          Elementが開始されたことを出力します.
protected  void printLeaveMessage(Element e)
          Elementが終了したことを出力します.
 boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
           
 
クラス javax.annotation.processing.AbstractProcessor から継承されたメソッド
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, getSupportedSourceVersion, init, isInitialized
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

SPACES

protected static final char[] SPACES
インデント用の空白 (100 文字)


out

protected PrintWriter out
出力先


depth

protected int depth
階層の深さ

コンストラクタの詳細

PrintingProcessor

public PrintingProcessor()
インスタンスを構築します.


PrintingProcessor

public PrintingProcessor(PrintWriter out)
インスタンスを構築します.

パラメータ:
out - 出力先
メソッドの詳細

process

public boolean process(Set<? extends TypeElement> annotations,
                       RoundEnvironment roundEnv)
定義:
インタフェース Processor 内の process
定義:
クラス AbstractProcessor 内の process

printEnterMessage

protected void printEnterMessage(Element e)
Elementが開始されたことを出力します.

パラメータ:
e - Element

printLeaveMessage

protected void printLeaveMessage(Element e)
Elementが終了したことを出力します.

パラメータ:
e - Element

indent

protected void indent(int depth)
インデントを出力します.

パラメータ:
depth - インデントの深さ


Copyright © 2009-2010 The Seasar Foundation. All Rights Reserved.