-
Notifications
You must be signed in to change notification settings - Fork 19
Lists
paradigmatic edited this page Sep 4, 2011
·
4 revisions
Configrity allows lists as configuration values. The string representation (stored in files and used internally) must be properly formatted as follows:
- The elements must be enclosed inside square brackets
[ ... ]
- The elements must be separated with commas
,
- Whitespaces (and new lines) are ignored (except in quoted elements)
- Elements must be quoted if they contain any of
=#{}[],
For instance valid lists representations are:
foo = [ 1, 2, 4, 8 ]
goo = [ hi, "hello world", "random ramblings: [][[##[[][{}" ]
hoo = [ on,
off,
on ]
You can retrieve any List type if there exists an implicit value converter for the element type (see ValueConversions). With preceding example:
val nums = config[List[Int]]( "foo" ) // nums == List( 1, 2, 4, 8)
Any list added to a configuration will be automatically converted to the correct string representation:
val list = List( true, false, true )
config.set( "list", list )