Partitions / Sections / Namespaces
Parameters' sections (or partitions or namespaces, as you like) are contained in their names. HOCON uses a period (.
) as path delimiter and this applies to parameter names as well. A section is defined as any part of the parameter name but the last (which is the parameter's actual name): section.subsection.name
.
Sections can be specified at various stages / places:
At class creation.
As part of the parameter's name.
In place of the parameter's name.
Class sections
Sections that apply to complete classes are declared as part of the class:
The specified path can be any valid HOCON path expression (e.g. path='library.book'
results in Book.title.name == 'library.book.title'
). It is prepended to the name (or path) of all declared parameters.
By default the path completion feature only works inside class definitions. That is if you set a parameter on an existing class it won't have its name prefixed unless you install the corresponding add-on (see Parameter names).
Full name sections
We can specify a section as part of a parameter's name as for example:
This can also be combined with class sections:
Prefix sections
Instead of specifying the full name of a parameter we can also only specify the parameter's section followed by a period and make use of the libraries feature to automatically derive the parameter name from the field name:
Again this feature works together with class-wide sections:
By default the path completion feature only works inside class definitions. That is if you set a parameter on an existing class it won't have its name derived by autocomplete unless you install the corresponding add-on (see Parameter names).
Last updated