OptionsResolver

A helper class used to obtain all the parameters from the “options” configuration section.

Description

The OptionsResolver class can be use to obtain all the parameters under the section “options” from a CongifParams object. It has a single method called “resolve”.

Static methods

resolve

Resolves an “options” configuration section from component configuration parameters.

static ConfigParams resolve(ConfigParams config, [bool configAsDefault = false])

  • config: ConfigParams - configuration parameters
  • configAsDefault: bool - (optional) When set true the method returns the entire parameter set when “options” section is not found. Default: false
  • returns: ConfigParams - configuration parameters from “options” section

Examples

var config = ConfigParams.fromTuples([
    ...
    'options.param1', 'ABC',
    'options.param2', 123
]);

var options = OptionsResolver.resolve(config); // Result: param1=ABC;param2=123