Skip to content

Commit e64f5f5

Browse files
authored
Merge pull request #270 from domaframework/translate-and-remove-docs
Translate documents from Japanese into English
2 parents 411f9dd + e191976 commit e64f5f5

File tree

8 files changed

+277
-467
lines changed

8 files changed

+277
-467
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/build.rst

Lines changed: 52 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,77 @@
1-
==================
2-
ビルド
3-
==================
1+
=======================
2+
Building an application
3+
=======================
44

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

8+
Before You Start
9+
================
10+
811
Maven Central Repository
9-
========================
12+
------------------------
1013

11-
Doma の jar ファイルは Maven Central Repository から入手できます。
12-
GroupId と ArtifactId の名称は以下の通りです。
14+
You can pull the jar file of the Doma framework from the Maven central repository.
15+
The group id and artifact id are as follows:
1316

1417
:GroupId: org.seasar.doma
1518
:ArtifactId: doma
1619

17-
.. _eclipse-build:
18-
19-
Eclipse を使ったビルド
20-
======================
20+
See also: https://search.maven.org/artifact/org.seasar.doma/doma/
2121

22-
Eclipse でビルドを行う際のポイントは以下の通りです。
22+
.. _eclipse-build:
2323

24-
* プロジェクトの設定で注釈処理を有効にする
25-
* Build Path に加えて Factory Path にも Doma の jar ファイルを設定する
24+
Build with Eclipse
25+
==================
2626

2727
.. note::
2828

29-
手動で設定するよりも Gradle の eclipse タスクで自動設定することを推奨します。
30-
詳細については、
31-
`domaframework/simple-boilerplate <https://github.com/domaframework/simple-boilerplate>`_
32-
に含まれる build.gradle と eclipse.gradle を参照ください。
29+
Instead of manual settings we show you below,
30+
we recommend to generate eclipse setting files automatically with
31+
`the Gradle Eclipse Plugin <https://docs.gradle.org/current/userguide/eclipse_plugin.html>`_.
32+
See also build.gradle and eclipse.gradle in the
33+
`domaframework/simple-boilerplate <https://github.com/domaframework/simple-boilerplate>`_
34+
repository.
3335

34-
注釈処理の有効化
35-
----------------
36+
Enabling annotation processing
37+
------------------------------
3638

37-
注釈処理を有効化するには、メニューから Project > Properties を選んで画面を開き
38-
左のメユーから Java Compiler > Annotation Processing を選択します。
39-
40-
そして、下記に示すチェックボックスにチェックを入れます。
39+
- Select "Project > Properties" from the menu bar and open the dialog
40+
- Select "Java Compiler > Annotation Processing" from the left menu of the dialog
41+
- Check as follows:
4142

4243
.. image:: images/annotation-processing.png
4344
:width: 80 %
4445

45-
|
46-
47-
Factory Path の設定
48-
-------------------
46+
Setting factory path
47+
--------------------
4948

50-
注釈処理を有効化するには、メニューから Project > Properties を選んで画面を開き
51-
左のメユーから Java Compiler > Annotation Processing > Factory Path を選択します。
52-
53-
そして、下記に示すチェックボックスにチェックを入れ、
54-
ビルドパスで指定しているのと同じバージョンの Doma の jar を登録します。
49+
- Select "Project > Properties" from the menu bar and open the dialog
50+
- Select "Java Compiler > Annotation Processing > Factory Path" from the left menu of the dialog
51+
- Add the jar file of the Doma framework whose version is same as the one in the Java Build Path
52+
- Check as follows:
5553

5654
.. image:: images/factory-path.png
5755
:width: 80 %
5856

59-
|
60-
61-
IntelliJ IDEA を使ったビルド
62-
================================
63-
64-
IntelliJ IDEA でビルドを行う際のポイントは以下の通りです。
65-
66-
* Module の設定で Inherit project compile output pathを有効にする
67-
* Preferences の設定で注釈処理を有効にする
68-
* 注釈処理で生成されたコードが出力されるディレクトリを Generated Sources Root に設定する
69-
70-
詳細な設定方法については :ref:`idea-annotation-processor` を参照してください。
57+
Build with IntelliJ IDEA
58+
========================
7159

72-
Gradle を使ったビルド
73-
=====================
60+
See :ref:`idea-annotation-processor`.
7461

75-
Gradle でビルドを行う際のポイントは以下のとおりです。
62+
.. _build-with-gradle:
7663

77-
* compileJava実行前にdomaが注釈処理で参照するリソースをcompileJavaタスクの出力先ディレクトリにコピーする
78-
* テスト時は注釈処理を無効にする
79-
* 依存関係の設定でdomaの注釈処理を実行することを示す
80-
* 依存関係の設定でdomaへの依存を示す
64+
Build with Gradle
65+
=================
8166

82-
サンプルのbuild.gradleです。
67+
build.gradle as an example:
8368

8469
.. code-block:: groovy
8570
8671
apply plugin: 'java'
8772
88-
// domaが注釈処理で参照するリソースをcompileJavaタスクの出力先ディレクトリにコピーする
73+
// Copy the resources referred by the Doma annotation processors to
74+
// the destinationDir of the compileJava task
8975
task copyDomaResources(type: Sync) {
9076
from sourceSets.main.resources.srcDirs
9177
into compileJava.destinationDir
@@ -94,22 +80,20 @@ Gradle でビルドを行う際のポイントは以下のとおりです。
9480
include 'META-INF/**/*.script'
9581
}
9682
97-
 compileJava {
98-
   // 上述のタスクに依存させる
99-
   dependsOn copyDomaResources
100-
  options.encoding = 'UTF-8'
101-
 }
83+
compileJava {
84+
// Depend on the above task
85+
dependsOn copyDomaResources
86+
options.encoding = 'UTF-8'
87+
}
10288
10389
compileTestJava {
10490
options.encoding = 'UTF-8'
105-
// テストの実行時は注釈処理を無効にする
91+
// Disable the annotation processors during the test run
10692
options.compilerArgs = ['-proc:none']
10793
}
10894
10995
dependencies {
110-
// domaの注釈処理を実行することを示す
11196
annotationProcessor "org.seasar.doma:doma:2.21.1-SNAPSHOT"
112-
// domaへの依存を示す
11397
implementation "org.seasar.doma:doma:2.21.1-SNAPSHOT"
11498
}
11599
@@ -120,18 +104,13 @@ Gradle でビルドを行う際のポイントは以下のとおりです。
120104
121105
.. note::
122106

123-
リポジトリにおける https://oss.sonatype.org/content/repositories/snapshots/ の設定は
124-
Doma の SNAPSHOT を参照したい場合にのみ必要です。
125-
126-
Doma の SNAPSHOT は `Travis-CI <https://travis-ci.org/domaframework/doma>`_
127-
でビルドが成功されるたびに作成されリポジトリに配置されます。
107+
The description ``maven {url 'https://oss.sonatype.org/content/repositories/snapshots/'}`` is required
108+
only when you need the SNAPSHOT version of the Doma framework.
128109

129110
.. note::
130111

131-
上述のbuild.gradleの書き方により、Gradle 5.0 で導入された
132-
`Incremental annotation processing <https://gradle.org/whats-new/gradle-5/#incremental-annotation-processing>`_ の恩恵を受けられます。
133-
112+
With the above build.gradle, you will benefits from
113+
`Incremental annotation processing <https://gradle.org/whats-new/gradle-5/#incremental-annotation-processing>`_.
134114

135-
Gradle を使ったより詳細なビルドスクリプトの例として、
136-
`domaframework/simple-boilerplate <https://github.com/domaframework/simple-boilerplate>`_
137-
を参照にしてください。
115+
See also build.gradle in the
116+
`domaframework/simple-boilerplate <https://github.com/domaframework/simple-boilerplate>`_ repository.

0 commit comments

Comments
 (0)