A helper class used by {@link PropertiesConfiguration} to keepthe layout of a properties file.
Instances of this class are associated with a {@code PropertiesConfiguration} object. They are responsible foranalyzing properties files and for extracting as much information about the file layout (e.g. empty lines, comments) as possible. When the properties file is written back again it should be close to the original.
The {@code PropertiesConfigurationLayout} object associated with a{@code PropertiesConfiguration} object can be obtained using the{@code getLayout()} method of the configuration. Then the methodsprovided by this class can be used to alter the properties file's layout.
Implementation note: This is a very simple implementation, which is far away from being perfect, i.e. the original layout of a properties file won't be reproduced in all cases. One limitation is that comments for multi-valued property keys are concatenated. Maybe this implementation can later be improved.
To get an impression how this class works consider the following properties file:
# A demo configuration file # for Demo App 1.42 # Application name AppName=Demo App # Application vendor AppVendor=DemoSoft # GUI properties # Window Color windowColors=0xFFFFFF,0x000000 # Include some setting include=settings.properties # Another vendor AppVendor=TestSoft
For this example the following points are relevant:
Application vendor<CR>Another vendor
, with <CR>
meaning the line separator. In addition the "single line" flag is set to false for this property. When the file is saved, two property definitions will be written (in series).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|