Description
Parameter set is an abstraction very often encountered in application development. Here
is an attempt to define it's characteristics:
- A set is composed of named parameters.
- A subset of parameters that share a common name prefix can be viewed as a nested
parameter set.
- Parameter values are primarily represented as strings
- Parameter values may be retrieved as instances of several Java primitive types, or
arrays thereof. At least following types need to be supported:
- String
- boolean
- int
- long
- float
- A NumberFormatException will be thrown by the numeric value retrieval methods if the
value is not a correct number representation.
- Parameter may have more than one value.
- Multiple values of a paremeter are ',' separated.
- ',' characters inside parameter values must be '\' escaped.
- The values of the parameter are returned in the same order that they are
defined.
- Different methods are used to retrieve a single value and all values of the
parameter. If one value is expected, but multiple are available, an unchecked
exception will be thrown.
- A default value may be provided upon retrieval of the parameter value. If the set
does not contain a value of the parameter the provided default will be returned.
- If no default value is provided and the set does not contain parameter value, an
unchecked exception will be thrown.
- The parameter set must be serializable as a human readable/editable string,
and deserializable from that representation.
- A parameter is represented as <name> '=' <values> pairs.
- Parameters withing a set are newline separater. Thus newline characters in
parameter values need to be '\' escaped.
- Any characters outside the 7 bit US-ASCII range must be escaped using Java
Unicode sequences when generating the string representation. Both escape
sequences and Unicode characters must be accepted when parsing.