Skip to content

Commit fe76254

Browse files
committed
Translate annotation-processing.rst
1 parent cc8457b commit fe76254

File tree

2 files changed

+79
-74
lines changed

2 files changed

+79
-74
lines changed

docs/annotation-processing.rst

Lines changed: 78 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,118 @@
1-
============================
2-
注釈処理
3-
============================
1+
=====================
2+
Annotation processing
3+
=====================
44

5-
.. contents:: 目次
5+
.. contents::
66
:depth: 3
77

8-
`Pluggable Annotation Processing API <https://www.jcp.org/en/jsr/detail?id=269>`_
9-
を利用すると、ソースコードの自動生成や検証を **コンパイル時** に行うことができます。
8+
Doma uses `Pluggable Annotation Processing API <https://www.jcp.org/en/jsr/detail?id=269>`_ at compile time.
109

11-
DomaではこのAPIを利用することで ``@Entity`` や ``@Dao`` と言ったアノテーションが注釈されたクラスやインタフェースを処理し、
12-
必要なクラスを自動生成します。
13-
また、注釈されたクラスやインタフェースの検証を行い、Domaの規約に従っていないソースコードがある場合は
14-
エラーメッセージをIDE(Eclipseなど)のエディタやjavacを実行したコンソール上に表示します。
10+
In this document, we describe the options for the annotation processors in Doma
11+
and show you how to pass them to build tools.
1512

16-
ここでは、Domaが提供するオプションの種類と、ビルドツールごとのオプションの設定方法を説明します。
17-
18-
オプション
19-
==================
13+
Options
14+
=======
2015

2116
doma.dao.package
22-
``@Dao`` が注釈されたインタフェースの実装クラスが生成されるパッケージ。
23-
何らかの値を指定した場合、doma.dao.subpackageの指定よりも優先される。
24-
デフォルトの値は、 ``@Dao`` が注釈されたインタフェースと同じパッケージ。
17+
The package that the generated implementation classes of interfaces annotated with ``@Dao`` belong to.
18+
The specified value overrides the value of doma.dao.subpackage.
19+
The default value is the same package as the one the interfaces annotated with ``@Dao`` belong to.
2520

2621
doma.dao.subpackage
27-
``@Dao`` が注釈されたインタフェースの実装クラスが生成されるサブパッケージ。
28-
doma.dao.packageに値を指定していない場合にのみ有効。
29-
``@Dao`` が注釈されたインタフェースのパッケージが ``example.dao`` で、ここに指定した値が ``impl`` の場合、
30-
生成されるクラスのパッケージは ``example.dao.impl`` となる。
22+
The subpackage that the generated implementation classes of interfaces annotated with ``@Dao`` belong to.
23+
The specified value is overridden by the value of doma.dao.package.
24+
If this value is ``impl`` and the package of interfaces annotated with ``@Dao`` is ``example.dao``,
25+
the generated implementation classes belong to the package ``example.dao.impl``.
3126

3227
doma.dao.suffix
33-
``@Dao`` が注釈されたインタフェースの実装クラスの名前のサフィックス。
34-
``@Dao`` が注釈されたインタフェースの単純名が ``EmployeeDao`` で、ここに指定した値が ``Bean`` の場合、
35-
生成されるクラスの単純名は ``EmployeeDaoBean`` となる。
36-
デフォルトの値は ``Impl``
28+
The name suffix that the generated implementation classes of interfaces annotated with ``@Dao`` have.
29+
If this value is ``Bean`` and the simple name of the interface annotated with ``@Dao`` is ``EmployeeDao``,
30+
the simple name of the generated implementation class is ``EmployeeDaoBean``.
31+
The default value is ``Impl``.
3732

3833
doma.debug
39-
注釈処理のデバッグ情報をログ出力するかどうか。
40-
``true`` の場合、ログ出力を行う。
41-
デフォルトの値は、 ``false``
34+
Whether to output the debug log in annotation processing.
35+
If the value is ``true``, the annotation processors output the debug log.
36+
The default value is ``false``.
4237

4338
doma.domain.converters
44-
任意の型と基本型を相互変換する ``DomainConverter`` のプロバイダとなるクラスの完全修飾名のカンマ区切り。
45-
クラスは ``org.seasar.doma.DomainConverters`` によって注釈されていないければいけない。
39+
The full qualified names of the classes annotated with ``@DomainConverters``.
40+
The names are described as comma separated list.
41+
This value are used to find external domain classes.
4642

4743
doma.entity.field.prefix
48-
``@Entity`` が注釈されたクラスごとに生成されるタイプクラスで使用される。
49-
タイプクラスのpublicなフィールド名のプレフィックス。
50-
``none`` を指定するとプレフィックスを使用しないという意味になる。
51-
デフォルトの値は、 ``$`` 。
44+
The name prefix that the fields of the generated entity meta classes have.
45+
The value ``none`` means the prefix is not used.
46+
The default value is ``$``.
5247

5348
doma.expr.functions
54-
式コメントで利用可能な関数群を表すクラスの完全修飾名。
55-
``org.seasar.doma.expr.ExpressionFunctions`` のサブタイプでなければいけない。
56-
デフォルトの値は、 ``org.seasar.doma.expr.ExpressionFunctions`` 。
49+
The full qualified name of the class that implements ``org.seasar.doma.expr.ExpressionFunctions``.
50+
The default value is ``org.seasar.doma.expr.ExpressionFunctions``.
51+
This value are used to determine which functions are available in expression comments.
5752

5853
doma.resources.dir
59-
SQLファイルなどリソースファイルの出力先ディレクトリ。
60-
絶対パスで指定する。
61-
指定しない場合はクラスファイルの出力先ディレクトリが使われる。
54+
The resource directory that contains the resource files such as a doma.compile.config file and sql files.
55+
Specify the value as an absolute path.
56+
If the value is not specified, the resource directory is same as the directory the classes are generated.
6257

6358
doma.sql.validation
64-
SQLファイルの存在チェックとSQLコメントの文法チェックを行う場合は ``true`` 。
65-
行わない場合は ``false`` 。
66-
デフォルトの値は、 ``true`` 。
59+
Whether to validate the existence of sql files and the grammar of sql comments.
60+
If the value is ``true``, the validations run.
61+
To disable the validations, set ``false``.
62+
The default value is ``true``.
6763

6864
doma.version.validation
69-
注釈処理によるソースコード生成で利用したDomaのバージョンと実行時のDomaのバージョンが同じであることを
70-
チェックする場合は ``true`` 。
71-
しない場合は ``false`` 。
72-
Domaのあるバージョンで生成されたコードを含むライブラリを作成する場合に ``false`` を指定してビルドすると、
73-
そのライブラリの再利用性が高まります。
74-
ライブラリが依存するDomaのバージョンとは異なるバージョンのDomaで実行できるからです
75-
(Domaのバージョンに互換性がある限りにおいて)。
76-
デフォルトの値は、 ``true`` 。
65+
Whether to validate the versions of doma.jar between runtime and compile-time.
66+
If the value is ``true``, the validation runs.
67+
To disable the validation, set ``false``.
68+
The default value is ``true``.
7769

7870
doma.config.path
79-
オプションの設定ファイルを置く場所の指定。
80-
デフォルトの値は、 ``doma.compile.config``
71+
The file path of the configuration file for Doma.
72+
The default value is ``doma.compile.config``.
8173

82-
Eclipse
83-
=======
74+
Setting options in Eclipse
75+
==========================
8476

85-
プロジェクトの「Properties」-「Java Compiler」-「Annotation Processing」の項目でオプションを登録します。
77+
- Select “Project > Properties” from the menu bar and open the dialog
78+
- Select “Java Compiler > Annotation Processing” from the left menu of the dialog
79+
- Add "Processor options"
8680

87-
IntelliJ IDEA
88-
=============
81+
Setting options in IntelliJ IDEA
82+
================================
8983

90-
Preferrences から Build, Execution, Deployment > Compiler > Annotation Processors の画面を開き登録します。
84+
- Select "Preferrences" from the menu bar and open the dialog
85+
- Select "Build, Execution, Deployment > Compiler > Annotation Processors" from the left menu of the dialog
86+
- Add "Annotation Processor options"
9187

92-
javac
93-
=====
88+
Setting options in javac
89+
========================
9490

95-
-Aオプションにより登録します。
96-
詳細はjavacのドキュメントを参照してください。
91+
- Use `the -A option <https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html#BHCDIFEE>`_
9792

98-
Gradle
99-
======
93+
Setting options in Gradle
94+
=========================
10095

101-
``compileJava.options.compilerArgs`` に指定します。
96+
- Use `the compilerArgs property
97+
<https://docs.gradle.org/5.0/dsl/org.gradle.api.tasks.compile.CompileOptions.html#org.gradle.api.tasks.compile.CompileOptions:compilerArgs>`_
10298

10399
.. code-block:: groovy
104100
105-
compileJava.options.compilerArgs = ['-Adoma.dao.subpackage=impl', '-Adoma.dao.suffix=Impl']
101+
compileJava {
102+
options {
103+
compilerArgs = ['-Adoma.dao.subpackage=impl', '-Adoma.dao.suffix=Impl']
104+
}
105+
}
106+
107+
Setting options with configuration file
108+
=======================================
109+
110+
The options specified in the ``doma.compile.config`` file are available in all build tools
111+
such as Eclipse, IDEA, Gradle and so on.
106112

107-
設定ファイル
108-
==================
113+
The ``doma.compile.config`` file must follow the properties file format
114+
and be placed in the root directory such as ``src/main/resources``.
109115

110-
デフォルトでは ``main/resources/doma.compile.config`` ファイルにオプションを記述しておくことで、
111-
ビルドツールごとのオプションの設定を利用する必要がなくなります。
112-
記述形式はプロパティファイルと同様です。
113-
なお、設定がバッティングした場合、ビルドツールごとのオプションの設定が優先されます。
116+
.. note::
117+
The options specified in the ``doma.compile.config`` file are overridden by
118+
the ones specific to the build tools.

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ User Documentation
4747
sql
4848
expression
4949
transaction
50-
annotation-processing
5150
build
51+
annotation-processing
5252
lombok-support
5353
kotlin-support
5454

0 commit comments

Comments
 (0)