UNPKG

6.3 kBTypeScriptView Raw
1/** @module run */
2import { AnyValueMap } from '../data/AnyValueMap';
3import { ConfigParams } from '../config/ConfigParams';
4/**
5 * Contains map with execution parameters.
6 *
7 * In general, this map may contain non-serializable values.
8 * And in contrast with other maps, its getters and setters
9 * support dot notation and able to access properties
10 * in the entire object graph.
11 *
12 * This class is often use to pass execution and notification
13 * arguments, and parameterize classes before execution.
14 *
15 * @see [[IParameterized]]
16 * @see [[AnyValueMap]]
17 */
18export declare class Parameters extends AnyValueMap {
19 /**
20 * Creates a new instance of the map and assigns its value.
21 *
22 * @param value (optional) values to initialize this map.
23 */
24 constructor(map?: any);
25 /**
26 * Gets a map element specified by its key.
27 *
28 * The key can be defined using dot notation
29 * and allows to recursively access elements of elements.
30 *
31 * @param key a key of the element to get.
32 * @returns the value of the map element.
33 */
34 get(key: string): any;
35 /**
36 * Puts a new value into map element specified by its key.
37 *
38 * The key can be defined using dot notation
39 * and allows to recursively access elements of elements.
40 *
41 * @param key a key of the element to put.
42 * @param value a new value for map element.
43 */
44 put(key: string, value: any): any;
45 /**
46 * Converts map element into an Parameters or returns null if conversion is not possible.
47 *
48 * @param key a key of element to get.
49 * @returns Parameters value of the element or null if conversion is not supported.
50 */
51 getAsNullableParameters(key: string): Parameters;
52 /**
53 * Converts map element into an Parameters or returns empty Parameters if conversion is not possible.
54 *
55 * @param key a key of element to get.
56 * @returns Parameters value of the element or empty Parameters if conversion is not supported.
57 */
58 getAsParameters(key: string): Parameters;
59 /**
60 * Converts map element into an Parameters or returns default value if conversion is not possible.
61 *
62 * @param key a key of element to get.
63 * @param defaultValue the default value
64 * @returns Parameters value of the element or default value if conversion is not supported.
65 */
66 getAsParametersWithDefault(key: string, defaultValue: Parameters): Parameters;
67 /**
68 * Checks if this map contains an element with specified key.
69 *
70 * The key can be defined using dot notation
71 * and allows to recursively access elements of elements.
72 *
73 * @param key a key to be checked
74 * @returns true if this map contains the key or false otherwise.
75 */
76 containsKey(key: string): boolean;
77 /**
78 * Overrides parameters with new values from specified Parameters
79 * and returns a new Parameters object.
80 *
81 * @param parameters Parameters with parameters to override the current values.
82 * @param recursive (optional) true to perform deep copy, and false for shallow copy. Default: false
83 * @returns a new Parameters object.
84 *
85 * @see [[setDefaults]]
86 */
87 override(parameters: Parameters, recursive?: boolean): Parameters;
88 /**
89 * Set default values from specified Parameters and returns a new Parameters object.
90 *
91 * @param defaultParameters Parameters with default parameter values.
92 * @param recursive (optional) true to perform deep copy, and false for shallow copy. Default: false
93 * @returns a new Parameters object.
94 *
95 * @see [[override]]
96 */
97 setDefaults(defaultParameters: Parameters, recursive?: boolean): Parameters;
98 /**
99 * Assigns (copies over) properties from the specified value to this map.
100 *
101 * @param value value whose properties shall be copied over.
102 */
103 assignTo(value: any): void;
104 /**
105 * Picks select parameters from this Parameters and returns them as a new Parameters object.
106 *
107 * @param paths keys to be picked and copied over to new Parameters.
108 * @returns a new Parameters object.
109 */
110 pick(...paths: string[]): Parameters;
111 /**
112 * Omits selected parameters from this Parameters and returns the rest as a new Parameters object.
113 *
114 * @param paths keys to be omitted from copying over to new Parameters.
115 * @returns a new Parameters object.
116 */
117 omit(...paths: string[]): Parameters;
118 /**
119 * Converts this map to JSON object.
120 *
121 * @returns a JSON representation of this map.
122 */
123 toJson(): string;
124 /**
125 * Creates a new Parameters object filled with key-value pairs from specified object.
126 *
127 * @param value an object with key-value pairs used to initialize a new Parameters.
128 * @returns a new Parameters object.
129 */
130 static fromValue(value: any): Parameters;
131 /**
132 * Creates a new Parameters object filled with provided key-value pairs called tuples.
133 * Tuples parameters contain a sequence of key1, value1, key2, value2, ... pairs.
134 *
135 * @param tuples the tuples to fill a new Parameters object.
136 * @returns a new Parameters object.
137 *
138 * @see [[AnyValueMap.fromTuplesArray]]
139 */
140 static fromTuples(...tuples: any[]): Parameters;
141 /**
142 * Merges two or more Parameters into one. The following Parameters override
143 * previously defined parameters.
144 *
145 * @param configs a list of Parameters objects to be merged.
146 * @returns a new Parameters object.
147 *
148 * @see [[AnyValueMap.fromMaps]]
149 */
150 static mergeParams(...parameters: Parameters[]): Parameters;
151 /**
152 * Creates new Parameters from JSON object.
153 *
154 * @param json a JSON string containing parameters.
155 * @returns a new Parameters object.
156 *
157 * @see [[JsonConverter.toNullableMap]]
158 */
159 static fromJson(json: string): Parameters;
160 /**
161 * Creates new Parameters from ConfigMap object.
162 *
163 * @param config a ConfigParams that contain parameters.
164 * @returns a new Parameters object.
165 *
166 * @see [[ConfigParams]]
167 */
168 static fromConfig(config: ConfigParams): Parameters;
169}