Parameters

Description

Parameter set is an abstraction very often encountered in application development. Here is an attempt to define it's characteristics:

  1. A set is composed of named parameters.
  2. A subset of parameters that share a common name prefix can be viewed as a nested parameter set.
  3. Parameter values are primarily represented as strings
    1. 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
    2. A NumberFormatException will be thrown by the numeric value retrieval methods if the value is not a correct number representation.
  4. Parameter may have more than one value.
    1. Multiple values of a paremeter are ',' separated.
    2. ',' characters inside parameter values must be '\' escaped.
    3. The values of the parameter are returned in the same order that they are defined.
    4. 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.
  5. 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.
  6. If no default value is provided and the set does not contain parameter value, an unchecked exception will be thrown.
  7. The parameter set must be serializable as a human readable/editable string, and deserializable from that representation.
    1. A parameter is represented as <name> '=' <values> pairs.
    2. Parameters withing a set are newline separater. Thus newline characters in parameter values need to be '\' escaped.
    3. 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.

Browse

Implementations

  • DefaultParamteres is a transient, memory based implementation of Parameters interface.

    more

  • DBParamteres is a persistent, database based implementation of Parameters interface.

    more