Implements: IContext
Description
TODO: add description
Constructors
Creates a new instance of the map and assigns its value.
publicconstructor(values: any = null)
- values: any - (optional) object to be converted into key-value pairs to initialize this config map.
Instance Methods
get
Adds parameters into this ConfigParams under a specified section. Keys for the new parameters are appended with section dot prefix.
publicget(key: string): any
- key: string - a key of the element to get.
- returns: any - the value of the map element.
toJson
Converts this map to JSON object.
publictoJson(): string
- returns: string - a JSON representation of this map.
Static methods
fromConfig
Creates new Context from ConfigMap object.
public staticfromConfig(config: ConfigParams): Context
- config: ConfigParams - a ConfigParams that contain parameters.
- returns: Context - a new Context object.
fromTraceId
Creates new Context from ConfigMap object.
public staticfromTraceId(traceId: string): Context
- traceId: string - a transaction id to trace execution through call chain.
- returns: Context - a new Context object.
fromString
Creates a new ConfigParams object filled with key-value pairs serialized as a string.
public staticfromString(line: string): ConfigParams
- line: string - string with serialized key-value pairs as “key1=value1;key2=value2;…”
Example: “Key1=123;Key2=ABC;Key3=2016-09-16T00:00:00.00Z” - returns: ConfigParams - new ConfigParams object.
fromTuples
Creates a new Context object filled with provided key-value pairs called tuples. Tuples parameters contain a sequence of key1, value1, key2, value2, … pairs.
See StringValueMap.fromTuplesArray
public staticfromTuples(…tuples: any[]): ConfigParams
- tuples: any[] - tuples to fill a new ConfigParams object.
- returns: ConfigParams - new ConfigParams object.
fromValue
Creates a new Parameters object filled with key-value pairs from specified object.
public staticfromValue(value: any): ConfigParams
- value: any - object with key-value pairs used to initialize a new ConfigParams.
- returns: ConfigParams - new ConfigParams object.
fromJson
Creates a new Parameters object filled with key-value pairs from specified object.
public staticfromJson(json: string): Context
- value: any - object with key-value pairs used to initialize a new ConfigParams.
- returns: ConfigParams - new ConfigParams object.