|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Object org.seasar.aptina.commons.source.SimpleSourceGenerator<T>
T
- パターンを定義した列挙の型public abstract class SimpleSourceGenerator<T extends Enum<T> & EnumMessageCode>
printf
でソースを生成する単純なジェネレータのための抽象クラスです.
フィールドの概要 | |
---|---|
protected StringBuilder |
buf
ソースの文字列バッファ |
protected int |
depth
インデントの深さ |
protected EnumMessageFormatter<T> |
enumFormatter
列挙に定義されたパターンを使用するフォーマッタ |
protected ProcessingEnvironment |
env
ProcessingEnvironment |
protected Formatter |
formatter
フォーマッタ |
protected static char[] |
SPACES
インデント用の空白 |
コンストラクタの概要 | |
---|---|
SimpleSourceGenerator(ProcessingEnvironment env,
Class<T> enumClass)
インスタンスを構築します. |
メソッドの概要 | |
---|---|
protected void |
enter()
インデントの階層を下げます. |
protected void |
indent()
インデントを出力します. |
protected void |
indent(int spaces)
インデントを出力します. |
protected void |
leave()
インデントの階層を上げます. |
protected void |
printf(String format,
Object... args)
フォーマットした文字列を出力します. |
protected void |
printf(T code,
Object... args)
列挙で示されるパターンを使ってフォーマットした文字列を出力します. |
protected void |
printGeneratedAnnotation(String productName,
String groupId,
String artifactId)
Generated アノテーションを出力します. |
protected void |
printJavadoc(String comment)
Javadoc コメントを出力します. |
protected void |
printJavadoc(T code,
Object... args)
列挙で指定されたパターンを使って組み立てたメッセージを Javadoc コメントを出力します. |
protected void |
reset()
生成されたソースを破棄し,状態をリセットします. |
String |
toString()
生成されたソースを返します. |
protected void |
write(String className,
TypeElement originalElement)
生成されたソースを Filer に出力します. |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
フィールドの詳細 |
---|
protected static final char[] SPACES
protected final ProcessingEnvironment env
ProcessingEnvironment
protected final StringBuilder buf
protected final Formatter formatter
protected final EnumMessageFormatter<T extends Enum<T> & EnumMessageCode> enumFormatter
protected int depth
コンストラクタの詳細 |
---|
public SimpleSourceGenerator(ProcessingEnvironment env, Class<T> enumClass)
env
- ProcessingEnvironment
enumClass
- パターンを定義した列挙のクラスメソッドの詳細 |
---|
public String toString()
Object
内の toString
protected void reset()
protected void write(String className, TypeElement originalElement) throws IOException
Filer
に出力します.
className
- 生成されたクラスの完全限定名originalElement
- 生成されたクラスの元になった Element
IOException
- 入出力例外が発生した場合protected void enter()
protected void leave()
protected void indent()
protected void indent(int spaces)
spaces
- インデントするスペースの数protected void printf(String format, Object... args)
先頭にはインデントが付けられます.
format
- パターン文字列args
- パターンから参照される引数の並びprotected void printf(T code, Object... args)
先頭にはインデントが付けられます.
code
- パターンを示す列挙args
- パターンから参照される引数の並びprotected void printJavadoc(String comment)
先頭にはインデントが付けられます.
引数で渡されたコメントは Elements.getDocComment(Element)
が返す文字列と同じ形式の文字列として扱われます. この形式は, Javadoc コメントから各行の先頭の "*"
までを除去したものです. 最初の行は空白 ("/**" の後に改行があるため) で, 最初と最後を除いた各行の先頭は空白 (
"/*" の後の空白) で始まります.
comment
- コメントprotected void printJavadoc(T code, Object... args)
先頭にはインデントが付けられます.
組み立てられたコメントは Elements.getDocComment(Element)
が返す文字列と同じ形式の文字列として扱われます. この形式は, Javadoc コメントから各行の先頭の "*"
までを除去したものです. 最初の行は空白 ("/**" の後に改行があるため) で, 最初と最後を除いた各行の先頭は空白 (
"/*" の後の空白) で始まります.
code
- パターンを示す列挙args
- パターンから参照される引数の並びprotected void printGeneratedAnnotation(String productName, String groupId, String artifactId)
Generated
アノテーションを出力します.
アノテーションの属性には引数で渡された項目に加えて,
VersionUtils.getVersion(String, String, String)
で取得したバージョン情報が出力されます. バージョン情報が取得できなかった場合は "DEV" が出力されます.
productName
- プロダクト名groupId
- グループ IDartifactId
- アーティファクト ID
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |