-
Notifications
You must be signed in to change notification settings - Fork 19
Formats
The flat format (org.streum.configrity.io.FlatFormat
) is composed of a list of entries taking the form:
key = value
Where key is a string which can contain any character except: #
, =
or any whitespace character (space, tab, newline, etc.) It cannot start or end with the dot: .
. The value is either:
- a word composed of any character except:
#
,=
any whitespace character; - any string surrounded by double quotes
"
(which does not contain any other double quote character).
All whitespace around expressions are ignored. Everything starting with #
is a comment and is then ignored.
For instance, the following text is valid:
site.url = http://www.example.com/3
site.credentials.username = bob
site.credentials.password = "b0b rul3z !!!"
upload.retrying = on
upload.retrying.times = 3
The Flat Format rules are defined in files src/io/StandardFormat.scala
and src/io/StandardFormat.scala
.
Block format (org.streum.configrity.io.BlockFormat
) is an extension of Flat format (see above). All texts parsed by Flat format are also valid Block format texts. The only extension is the introduction of blocks:
blockKey {
content
}
Where blockKey has the same restrictions as Flat format keys and content is a list of either key = value
entries or other blocks. The order is not important. A block cannot be empty.
For instance, the following text is valid and the generated Configuration equals the one generated by the Flat format example:
site {
url = http://www.example.com/3
credentials {
username = bob
password = "b0b rul3z !!!"
}
}
upload {
retrying = on
retrying {
times = 3
}
}
Both style can be mixed, so last examples is identical to:
site {
url = http://www.example.com/3
credentials.username = bob
credentials.password = "b0b rul3z !!!"
}
upload.retrying = on
upload.retrying {
times = 3
}
JProperty Format (org.streum.configrity.JProperties.format
) is the standard text format of java.util.Properties
, described in:
http://download.oracle.com/javase/6/docs/api/java/util/Properties.html
It allows interoperability for legacy java code and scripts.