-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
238a6a4
commit 3f738b7
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Jackson-Java Coding Style Guide | ||
|
||
This document serves as the coding conventions for Java source code in the Jackson project. It's inspired by the Google | ||
Java Style Guide. | ||
|
||
## Table of Contents | ||
|
||
1. [Source Formatting](#source-formatting) | ||
1. [Indentation](#indentation) | ||
2. [Import Statements](#import-statements) | ||
1. [Wildcard Imports](#wildcard-imports) | ||
2. [Ordering](#ordering) | ||
2. [Naming Conventions](#naming-conventions) | ||
1. [Field Naming](#field-naming) | ||
2. [Method Naming](#method-naming) | ||
|
||
## Source Formatting | ||
|
||
### Indentation | ||
|
||
- **Rule**: Use spaces instead of tabs. | ||
- **Amount**: 4 spaces per indentation level. | ||
|
||
### Import Statements | ||
|
||
#### Wildcard Imports | ||
|
||
- **Usage**: Wildcards are permissible. | ||
- **Threshold**: Employ wildcards for 5 or more imports from the same package. | ||
- **Exceptions**: For frequently used packages like `java.util`, `java.io`, and main Jackson packages ( | ||
e.g., `com.fasterxml.jackson.databind`), wildcards may be used for fewer imports. | ||
|
||
#### Ordering | ||
|
||
1. **JDK Imports**: Begin with standard Java (JDK) imports. | ||
2. **Jackson Imports**: Follow with Jackson imports, starting from base types (annotations, core, databind), ordered | ||
from foundational to higher-level. | ||
|
||
## Naming Conventions | ||
|
||
### Field Naming | ||
|
||
- **Non-Public Fields**: Prefix non-public member fields with an underscore (e.g., `_fieldName`). | ||
|
||
### Method Naming | ||
|
||
- **Public Methods**: Adhere to standard Java naming conventions. | ||
- **Internal Methods**: Prefix methods used within the class with an underscore. | ||
- **Sub-Class Methods**: Optionally, use a leading underscore for methods intended for subclass use, but not for | ||
external class calls. |