Add naming convention (#2061)
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>pull/2063/head
parent
a890e929a3
commit
ca8c303d57
|
@ -28,8 +28,8 @@ The structure of a binding follows the structure of a typical OSGi bundle projec
|
||||||
|---- java Your Java code
|
|---- java Your Java code
|
||||||
|-------- org/openhab/[...]
|
|-------- org/openhab/[...]
|
||||||
|- src/main/resources/OH-INF
|
|- src/main/resources/OH-INF
|
||||||
|---- binding
|
|---- addon
|
||||||
|-------- binding.xml Binding name, description and other meta data
|
|-------- addon.xml Binding name, description and other meta data
|
||||||
|---- config Configuration description files when not in things files
|
|---- config Configuration description files when not in things files
|
||||||
|-------- *.xml
|
|-------- *.xml
|
||||||
|---- i18n Your localized binding texts
|
|---- i18n Your localized binding texts
|
||||||
|
@ -51,6 +51,20 @@ The structure of a binding follows the structure of a typical OSGi bundle projec
|
||||||
|
|
||||||
## B. Code formatting rules & style
|
## B. Code formatting rules & style
|
||||||
|
|
||||||
|
### Naming Convention
|
||||||
|
|
||||||
|
To ensure consistency for users, new bindings should use the following naming convention:
|
||||||
|
|
||||||
|
- Thing type id: `lower-case-hyphen`
|
||||||
|
- Channel type id: `lower-case-hyphen`
|
||||||
|
- Channel group id: `lower-case-hyphen`
|
||||||
|
- Channel id: `lower-case-hyphen`
|
||||||
|
- Thing property: `camelCase`
|
||||||
|
- Config parameter: `camelCase`
|
||||||
|
- Profile URI: `lower-case-hyphen`
|
||||||
|
- Profile type id for transformations: `UPPER_CASE`
|
||||||
|
- XML files in src/*/resources: `lower-case-hyphen.xml`
|
||||||
|
|
||||||
### Code format
|
### Code format
|
||||||
|
|
||||||
In order to keep the code layout consistent, code formatting rules have been defined.
|
In order to keep the code layout consistent, code formatting rules have been defined.
|
||||||
|
@ -82,7 +96,6 @@ The rules are defined at <https://github.com/openhab/static-code-analysis/tree/m
|
||||||
### Java Coding Style
|
### Java Coding Style
|
||||||
|
|
||||||
- The [Java naming conventions](https://java.about.com/od/javasyntax/a/nameconventions.htm) should always be used and are described in detail at the link, a quick summary is:
|
- The [Java naming conventions](https://java.about.com/od/javasyntax/a/nameconventions.htm) should always be used and are described in detail at the link, a quick summary is:
|
||||||
- Channel IDs: `lowerCamelCase`
|
|
||||||
- Variables: `lowerCamelCase`
|
- Variables: `lowerCamelCase`
|
||||||
- Constants: `ALL_UPPER_CASE`
|
- Constants: `ALL_UPPER_CASE`
|
||||||
- Generics must be used where applicable. See example below:
|
- Generics must be used where applicable. See example below:
|
||||||
|
|
Loading…
Reference in New Issue