Apex コードスタイルガイド
はじめに
0.1.
用語についての注記
0.2.
ガイドについての注記
1.
ソースファイルの基本事項
1.1.
特殊文字
1.1.1.
空白
1.1.2.
特別なエスケープシーケンス
1.1.3.
非ASCII文字
2.
ソースファイルの構造
2.1.
ライセンスあるいはコピーライトの情報(もしあるならば)
2.2.
パッケージ文
2.3.
インポート文
2.3.1.
ワイルドカードインポートは禁止
2.3.2.
改行禁止
2.3.3.
順序と空白
2.4.
クラス宣言
2.4.1.
1つだけのトップレベルクラスの宣言
2.4.2.
クラスメンバーの順序
2.4.2.1.
オーバーロードしているメソッド群を分離してはいけません
3.
フォーマット
3.1.
中括弧
3.1.1.
使えるところでは中括弧を使用します
3.1.2.
空でないブロックは:K&Rスタイル
3.1.3.
空ブロックは簡潔に
3.2.
Block indentation: +2 spaces
3.3.
One statement per line
3.4.
Column limit: 80 or 100
3.5.
Line-wrapping
3.5.1.
Where to break
3.5.2.
Indent continuation lines at least +4 spaces
3.6.
Whitespace
3.6.1.
Vertical Whitespace
3.6.2.
Horizontal whitespace
3.6.3.
Horizontal alignment: never required
3.7.
Grouping parentheses: recommended
3.8.
Specific constructs
3.8.1.
Enum classes
3.8.2.
Variable declarations
3.8.2.1.
One variable per declaration
3.8.2.2.
Declared when needed, initialized as soon as possible
3.8.3.
Arrays
3.8.3.1.
Array initializers: can be "block-like"
3.8.3.2.
No C-style array declarations
3.8.4.
Switch statements
3.8.4.1.
Indentation
3.8.4.2.
Fall-through: commented
3.8.4.3.
The default case is present
3.8.5.
Annotations
3.8.6.
Comments
3.8.6.1.
Block comment style
3.8.7.
Modifiers
3.8.8.
Numeric Literals
4.
命名ルール
5.
実践的なプログラミング
Powered by
GitBook
Apex コードスタイルガイド
用語についての注記
本文書において、特別に断りのない限り、
クラスという用語は、「通常の」クラス、
列挙型
、
インターフェース
、
アノテーション型
を包括的に意味します。
コメントという用語は、常に実装のコメントを意味します。「ドキュメンテーションコメント」という言い方は使いません。
本文書では他の用語の注記は適宜行われます。