Parameters

Contains a map with execution parameters.

Inherits: AnyValueMap

Description

The Parameters class contains a map with execution paramters.

Important points

  • In general, this map may contain non-serializable values.
  • In contrast to other maps, its getters and setters support dot notation and are able to access properties in the entire object graph.
  • This class is often used to pass execution and notification arguments, and parameterize classes before execution.

Constructors

Creates a new instance of the map and assigns its value.

public Parameters(IDictionary map)

  • map: IDictionary - (optional) values used to initialize this map.

Creates a new instance of the map.

public Parameters()

Instance methods

AssignTo

Assigns (copies over) properties from the specified value to this map.

public void AssignTo(object value)

  • value: object - value whose properties shall be copied over.

ContainsKey

Checks if this map contains an element with a specified key.

The key can be defined using dot notation and allows to recursively access elements of elements.

public new bool ContainsKey(string key)

  • key: string - key to be checked
  • returns: bool - true if this map contains the key or false otherwise.

Get

Gets a map element specified by its key. The key can be defined using dot notation and allows to recursively access elements of elements.

public override object Get(string key)

  • key: string - key of the element to get.
  • returns: object - value of the map element.

GetAsNullableParameters

Converts map element into a Parameters object or returns null if the conversion is not possible.

public Parameters GetAsNullableParameters(string key)

  • key: string - key of element to get.
  • returns: Parameters - Parameters object with the value of the element or null if conversion is not supported.

GetAsParameters

Converts a map element into a Parameters object or returns an empty Parameters object if the conversion is not possible.

public Parameters GetAsParameters(string key)

  • key: string - key of element to get.
  • returns: Parameters - Parameters object with the value of the element or an empty Parameters object if the conversion is not supported.

GetAsParametersWithDefault

Converts a map element into a Parameters object or returns a given default Parameters object if the conversion is not possible.

public Parameters GetAsParametersWithDefault(string key, Parameters defaultValue)

  • key: string - key of element to get.
  • defaultValue: Parameters - default value
  • returns: Parameters - Parameters object with the value of the element or given default Parameters object if conversion is not supported.

Omit

Omits selected parameters from this Parameters object and returns the remaining ones as a new Parameters object.

public Parameters Omit(params string[] paths)

Override

Overrides parameters with new values from a specified Parameters object and returns a new Parameters object.

public Parameters Override(Parameters parameters)

  • parameters: Parameters - Parameters object with the parameters to override the current values.
  • returns: Parameters - new Parameters object.

Override

Overrides parameters with new values from a specified Parameters object and returns a new Parameters object.

public Parameters Override(Parameters parameters, bool recursive)

  • parameters: Parameters - Parameters object with parameters to override the current values.
  • recursive: bool - (optional) true to perform deep copy, and false for shallow copy. Default: false
  • returns: Parameters - new Parameters object.

Pick

Picks selected parameters from this Parameters object and returns them as a new Parameters object.

public Parameters Pick(params string[] paths)

  • paths: string[] - keys to be picked and copied over to a new Parameters object.
  • returns: Parameters - new Parameters object.

Set

Sets a new value into a map element specified by its key. The key can be defined using dot notation and allows to recursively access elements of elements.

public override void Set(string key, object value)

  • key: string - key of the element to put.
  • value: object - new value for map element.

SetDefaults

Sets default values from a specified Parameters object and returns a new Parameters object.

public Parameters SetDefaults(Parameters defaultParameters)

  • defaultParameters: Parameters - Parameters object with default parameter values.
  • returns: Parameters - new Parameters object.

SetDefaults

Sets default values from a specified Parameters object and returns a new Parameters object.

public Parameters SetDefaults(Parameters defaultParameters, bool recursive)

  • defaultParameters: Parameters - Parameters object with default parameter values.
  • recursive: bool - (optional) true to perform deep copy, and false for shallow copy. Default: false
  • returns: Parameters - new Parameters object.

Static methods

FromConfig

Creates new Parameters object from a ConfigMap object. See ConfigParams

public static Parameters FromConfig(ConfigParams config)

  • config: ConfigParams - ConfigParams object that contains parameters.
  • returns: Parameters - new Parameters object.

FromJson

Creates a new Parameters from a ConfigMap object.

public static Parameters FromJson(string json)

  • config: string - json string that contains parameters.
  • returns: Parameters - new Parameters object.

FromTuples

Creates a new Parameters object filled with provided key-value pairs called tuples. Tuples parameters contain a sequence of key1, value1, key2, value2, … pairs.

See AnyValueMap.FromTuplesArray

public new static Parameters FromTuples(params object[] tuples)

  • tuples: object[] - ConfigParams object that contains parameters.
  • returns: Parameters - new Parameters object.

MergeParams

Merges two or more Parameters objects into one. The following Parameters override previously defined parameters.

See AnyValueMap.FromMaps

public static Parameters MergeParams(params Parameters[] parameters)

  • parameters: Parameters[] - list of Parameters objects to be merged.
  • returns: Parameters - new Parameters object.

ToJson

Converts this map to a JSON object.

public string string ToJson()

  • returns: string - JSON representation of this map.

See also