1 | import { TypeCode } from '../convert/TypeCode';
|
2 | import { AnyValue } from './AnyValue';
|
3 | import { AnyValueArray } from './AnyValueArray';
|
4 | import { AnyValueMap } from './AnyValueMap';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | export declare class StringValueMap {
|
36 | |
37 |
|
38 |
|
39 |
|
40 |
|
41 | constructor(map?: any);
|
42 | /**
|
43 | * Gets a map element specified by its key.
|
44 | *
|
45 | * @param key a key of the element to get.
|
46 | * @returns the value of the map element.
|
47 | */
|
48 | get(key: string): string;
|
49 | /**
|
50 | * Gets keys of all elements stored in this map.
|
51 | *
|
52 | * @returns a list with all map keys.
|
53 | */
|
54 | getKeys(): string[];
|
55 | /**
|
56 | * Puts a new value into map element specified by its key.
|
57 | *
|
58 | * @param key a key of the element to put.
|
59 | * @param value a new value for map element.
|
60 | */
|
61 | put(key: string, value: any): any;
|
62 | /**
|
63 | * Removes a map element specified by its key
|
64 | *
|
65 | * @param key a key of the element to remove.
|
66 | */
|
67 | remove(key: string): void;
|
68 | /**
|
69 | * Appends new elements to this map.
|
70 | *
|
71 | * @param map a map with elements to be added.
|
72 | */
|
73 | append(map: any): void;
|
74 | /**
|
75 | * Clears this map by removing all its elements.
|
76 | */
|
77 | clear(): any;
|
78 | /**
|
79 | * Gets a number of elements stored in this map.
|
80 | *
|
81 | * @returns the number of elements in this map.
|
82 | */
|
83 | length(): number;
|
84 | /**
|
85 | * Gets the value stored in map element without any conversions.
|
86 | * When element key is not defined it returns the entire map value.
|
87 | *
|
88 | * @param key (optional) a key of the element to get
|
89 | * @returns the element value or value of the map when index is not defined.
|
90 | */
|
91 | getAsObject(key?: string): any;
|
92 | /**
|
93 | * Sets a new value to map element specified by its index.
|
94 | * When the index is not defined, it resets the entire map value.
|
95 | * This method has double purpose because method overrides are not supported in JavaScript.
|
96 | *
|
97 | * @param key (optional) a key of the element to set
|
98 | * @param value a new element or map value.
|
99 | *
|
100 | * @see [[MapConverter.toMap]]
|
101 | */
|
102 | setAsObject(key: any, value?: any): void;
|
103 | /**
|
104 | * Converts map element into a string or returns null if conversion is not possible.
|
105 | *
|
106 | * @param key a key of element to get.
|
107 | * @returns string value of the element or null if conversion is not supported.
|
108 | *
|
109 | * @see [[StringConverter.toNullableString]]
|
110 | */
|
111 | getAsNullableString(key: string): string;
|
112 | /**
|
113 | * Converts map element into a string or returns "" if conversion is not possible.
|
114 | *
|
115 | * @param key a key of element to get.
|
116 | * @returns string value of the element or "" if conversion is not supported.
|
117 | *
|
118 | * @see [[getAsStringWithDefault]]
|
119 | */
|
120 | getAsString(key: string): string;
|
121 | /**
|
122 | * Converts map element into a string or returns default value if conversion is not possible.
|
123 | *
|
124 | * @param key a key of element to get.
|
125 | * @param defaultValue the default value
|
126 | * @returns string value of the element or default value if conversion is not supported.
|
127 | *
|
128 | * @see [[StringConverter.toStringWithDefault]]
|
129 | */
|
130 | getAsStringWithDefault(key: string, defaultValue: string): string;
|
131 | /**
|
132 | * Converts map element into a boolean or returns null if conversion is not possible.
|
133 | *
|
134 | * @param key a key of element to get.
|
135 | * @returns boolean value of the element or null if conversion is not supported.
|
136 | *
|
137 | * @see [[BooleanConverter.toNullableBoolean]]
|
138 | */
|
139 | getAsNullableBoolean(key: string): boolean;
|
140 | /**
|
141 | * Converts map element into a boolean or returns false if conversion is not possible.
|
142 | *
|
143 | * @param key a key of element to get.
|
144 | * @returns boolean value of the element or false if conversion is not supported.
|
145 | *
|
146 | * @see [[getAsBooleanWithDefault]]
|
147 | */
|
148 | getAsBoolean(key: string): boolean;
|
149 | /**
|
150 | * Converts map element into a boolean or returns default value if conversion is not possible.
|
151 | *
|
152 | * @param key a key of element to get.
|
153 | * @param defaultValue the default value
|
154 | * @returns boolean value of the element or default value if conversion is not supported.
|
155 | *
|
156 | * @see [[BooleanConverter.toBooleanWithDefault]]
|
157 | */
|
158 | getAsBooleanWithDefault(key: string, defaultValue: boolean): boolean;
|
159 | /**
|
160 | * Converts map element into an integer or returns null if conversion is not possible.
|
161 | *
|
162 | * @param key a key of element to get.
|
163 | * @returns integer value of the element or null if conversion is not supported.
|
164 | *
|
165 | * @see [[IntegerConverter.toNullableInteger]]
|
166 | */
|
167 | getAsNullableInteger(key: string): number;
|
168 | /**
|
169 | * Converts map element into an integer or returns 0 if conversion is not possible.
|
170 | *
|
171 | * @param key a key of element to get.
|
172 | * @returns integer value of the element or 0 if conversion is not supported.
|
173 | *
|
174 | * @see [[getAsIntegerWithDefault]]
|
175 | */
|
176 | getAsInteger(key: string): number;
|
177 | /**
|
178 | * Converts map element into an integer or returns default value if conversion is not possible.
|
179 | *
|
180 | * @param key a key of element to get.
|
181 | * @param defaultValue the default value
|
182 | * @returns integer value of the element or default value if conversion is not supported.
|
183 | *
|
184 | * @see [[IntegerConverter.toIntegerWithDefault]]
|
185 | */
|
186 | getAsIntegerWithDefault(key: string, defaultValue: number): number;
|
187 | /**
|
188 | * Converts map element into a long or returns null if conversion is not possible.
|
189 | *
|
190 | * @param key a key of element to get.
|
191 | * @returns long value of the element or null if conversion is not supported.
|
192 | *
|
193 | * @see [[LongConverter.toNullableLong]]
|
194 | */
|
195 | getAsNullableLong(key: string): number;
|
196 | /**
|
197 | * Converts map element into a long or returns 0 if conversion is not possible.
|
198 | *
|
199 | * @param key a key of element to get.
|
200 | * @returns long value of the element or 0 if conversion is not supported.
|
201 | *
|
202 | * @see [[getAsLongWithDefault]]
|
203 | */
|
204 | getAsLong(key: string): number;
|
205 | /**
|
206 | * Converts map element into a long or returns default value if conversion is not possible.
|
207 | *
|
208 | * @param key a key of element to get.
|
209 | * @param defaultValue the default value
|
210 | * @returns long value of the element or default value if conversion is not supported.
|
211 | *
|
212 | * @see [[LongConverter.toLongWithDefault]]
|
213 | */
|
214 | getAsLongWithDefault(key: string, defaultValue: number): number;
|
215 | /**
|
216 | * Converts map element into a float or returns null if conversion is not possible.
|
217 | *
|
218 | * @param key a key of element to get.
|
219 | * @returns float value of the element or null if conversion is not supported.
|
220 | *
|
221 | * @see [[FloatConverter.toNullableFloat]]
|
222 | */
|
223 | getAsNullableFloat(key: string): number;
|
224 | /**
|
225 | * Converts map element into a float or returns 0 if conversion is not possible.
|
226 | *
|
227 | * @param key a key of element to get.
|
228 | * @returns float value of the element or 0 if conversion is not supported.
|
229 | *
|
230 | * @see [[getAsFloatWithDefault]]
|
231 | */
|
232 | getAsFloat(key: string): number;
|
233 | /**
|
234 | * Converts map element into a flot or returns default value if conversion is not possible.
|
235 | *
|
236 | * @param key a key of element to get.
|
237 | * @param defaultValue the default value
|
238 | * @returns flot value of the element or default value if conversion is not supported.
|
239 | *
|
240 | * @see [[FloatConverter.toFloatWithDefault]]
|
241 | */
|
242 | getAsFloatWithDefault(key: string, defaultValue: number): number;
|
243 | /**
|
244 | * Converts map element into a double or returns null if conversion is not possible.
|
245 | *
|
246 | * @param key a key of element to get.
|
247 | * @returns double value of the element or null if conversion is not supported.
|
248 | *
|
249 | * @see [[DoubleConverter.toNullableDouble]]
|
250 | */
|
251 | getAsNullableDouble(key: string): number;
|
252 | /**
|
253 | * Converts map element into a double or returns 0 if conversion is not possible.
|
254 | *
|
255 | * @param key a key of element to get.
|
256 | * @returns double value of the element or 0 if conversion is not supported.
|
257 | *
|
258 | * @see [[getAsDoubleWithDefault]]
|
259 | */
|
260 | getAsDouble(key: string): number;
|
261 | /**
|
262 | * Converts map element into a double or returns default value if conversion is not possible.
|
263 | *
|
264 | * @param key a key of element to get.
|
265 | * @param defaultValue the default value
|
266 | * @returns double value of the element or default value if conversion is not supported.
|
267 | *
|
268 | * @see [[DoubleConverter.toDoubleWithDefault]]
|
269 | */
|
270 | getAsDoubleWithDefault(key: string, defaultValue: number): number;
|
271 | /**
|
272 | * Converts map element into a Date or returns null if conversion is not possible.
|
273 | *
|
274 | * @param key a key of element to get.
|
275 | * @returns Date value of the element or null if conversion is not supported.
|
276 | *
|
277 | * @see [[DateTimeConverter.toNullableDateTime]]
|
278 | */
|
279 | getAsNullableDateTime(key: string): Date;
|
280 | /**
|
281 | * Converts map element into a Date or returns the current date if conversion is not possible.
|
282 | *
|
283 | * @param key a key of element to get.
|
284 | * @returns Date value of the element or the current date if conversion is not supported.
|
285 | *
|
286 | * @see [[getAsDateTimeWithDefault]]
|
287 | */
|
288 | getAsDateTime(key: string): Date;
|
289 | /**
|
290 | * Converts map element into a Date or returns default value if conversion is not possible.
|
291 | *
|
292 | * @param key a key of element to get.
|
293 | * @param defaultValue the default value
|
294 | * @returns Date value of the element or default value if conversion is not supported.
|
295 | *
|
296 | * @see [[DateTimeConverter.toDateTimeWithDefault]]
|
297 | */
|
298 | getAsDateTimeWithDefault(key: string, defaultValue: Date): Date;
|
299 | /**
|
300 | * Converts map element into a value defined by specied typecode.
|
301 | * If conversion is not possible it returns null.
|
302 | *
|
303 | * @param type the TypeCode that defined the type of the result
|
304 | * @param key a key of element to get.
|
305 | * @returns element value defined by the typecode or null if conversion is not supported.
|
306 | *
|
307 | * @see [[TypeConverter.toNullableType]]
|
308 | */
|
309 | getAsNullableType<T>(type: TypeCode, key: string): T;
|
310 | /**
|
311 | * Converts map element into a value defined by specied typecode.
|
312 | * If conversion is not possible it returns default value for the specified type.
|
313 | *
|
314 | * @param type the TypeCode that defined the type of the result
|
315 | * @param key a key of element to get.
|
316 | * @returns element value defined by the typecode or default if conversion is not supported.
|
317 | *
|
318 | * @see [[getAsTypeWithDefault]]
|
319 | */
|
320 | getAsType<T>(type: TypeCode, key: string): T;
|
321 | /**
|
322 | * Converts map element into a value defined by specied typecode.
|
323 | * If conversion is not possible it returns default value.
|
324 | *
|
325 | * @param type the TypeCode that defined the type of the result
|
326 | * @param key a key of element to get.
|
327 | * @param defaultValue the default value
|
328 | * @returns element value defined by the typecode or default value if conversion is not supported.
|
329 | *
|
330 | * @see [[TypeConverter.toTypeWithDefault]]
|
331 | */
|
332 | getAsTypeWithDefault<T>(type: TypeCode, key: string, defaultValue: T): T;
|
333 | /**
|
334 | * Converts map element into an AnyValue or returns an empty AnyValue if conversion is not possible.
|
335 | *
|
336 | * @param key a key of element to get.
|
337 | * @returns AnyValue value of the element or empty AnyValue if conversion is not supported.
|
338 | *
|
339 | * @see [[AnyValue]]
|
340 | * @see [[AnyValue.constructor]]
|
341 | */
|
342 | getAsValue(key: string): AnyValue;
|
343 | /**
|
344 | * Converts map element into an AnyValueArray or returns null if conversion is not possible.
|
345 | *
|
346 | * @param key a key of element to get.
|
347 | * @returns AnyValueArray value of the element or null if conversion is not supported.
|
348 | *
|
349 | * @see [[AnyValueArray]]
|
350 | * @see [[AnyValueArray.fromValue]]
|
351 | */
|
352 | getAsNullableArray(key: string): AnyValueArray;
|
353 | /**
|
354 | * Converts map element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible.
|
355 | *
|
356 | * @param key a key of element to get.
|
357 | * @returns AnyValueArray value of the element or empty AnyValueArray if conversion is not supported.
|
358 | *
|
359 | * @see [[AnyValueArray]]
|
360 | * @see [[AnyValueArray.fromValue]]
|
361 | */
|
362 | getAsArray(key: string): AnyValueArray;
|
363 | /**
|
364 | * Converts map element into an AnyValueArray or returns default value if conversion is not possible.
|
365 | *
|
366 | * @param key a key of element to get.
|
367 | * @param defaultValue the default value
|
368 | * @returns AnyValueArray value of the element or default value if conversion is not supported.
|
369 | *
|
370 | * @see [[AnyValueArray]]
|
371 | * @see [[getAsNullableArray]]
|
372 | */
|
373 | getAsArrayWithDefault(key: string, defaultValue: AnyValueArray): AnyValueArray;
|
374 | /**
|
375 | * Converts map element into an AnyValueMap or returns null if conversion is not possible.
|
376 | *
|
377 | * @param key a key of element to get.
|
378 | * @returns AnyValueMap value of the element or null if conversion is not supported.
|
379 | *
|
380 | * @see [[fromValue]]
|
381 | */
|
382 | getAsNullableMap(key: string): AnyValueMap;
|
383 | /**
|
384 | * Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible.
|
385 | *
|
386 | * @param key a key of element to get.
|
387 | * @returns AnyValueMap value of the element or empty AnyValueMap if conversion is not supported.
|
388 | *
|
389 | * @see [[fromValue]]
|
390 | */
|
391 | getAsMap(key: string): AnyValueMap;
|
392 | /**
|
393 | * Converts map element into an AnyValueMap or returns default value if conversion is not possible.
|
394 | *
|
395 | * @param key a key of element to get.
|
396 | * @param defaultValue the default value
|
397 | * @returns AnyValueMap value of the element or default value if conversion is not supported.
|
398 | *
|
399 | * @see [[getAsNullableMap]]
|
400 | */
|
401 | getAsMapWithDefault(key: string, defaultValue: AnyValueMap): AnyValueMap;
|
402 | /**
|
403 | * Gets a string representation of the object.
|
404 | * The result is a semicolon-separated list of key-value pairs as
|
405 | * "key1=value1;key2=value2;key=value3"
|
406 | *
|
407 | * @returns a string representation of the object.
|
408 | */
|
409 | toString(): string;
|
410 | /**
|
411 | * Creates a binary clone of this object.
|
412 | *
|
413 | * @returns a clone of this object.
|
414 | */
|
415 | clone(): any;
|
416 | /**
|
417 | * Converts specified value into StringValueMap.
|
418 | *
|
419 | * @param value value to be converted
|
420 | * @returns a newly created StringValueMap.
|
421 | *
|
422 | * @see [[setAsObject]]
|
423 | */
|
424 | static fromValue(value: any): StringValueMap;
|
425 | /**
|
426 | * Creates a new StringValueMap from a list of key-value pairs called tuples.
|
427 | *
|
428 | * @param tuples a list of values where odd elements are keys and the following even elements are values
|
429 | * @returns a newly created StringValueMap.
|
430 | *
|
431 | * @see [[fromTuplesArray]]
|
432 | */
|
433 | static fromTuples(...tuples: any[]): StringValueMap;
|
434 | /**
|
435 | * Creates a new StringValueMap from a list of key-value pairs called tuples.
|
436 | * The method is similar to [[fromTuples]] but tuples are passed as array instead of parameters.
|
437 | *
|
438 | * @param tuples a list of values where odd elements are keys and the following even elements are values
|
439 | * @returns a newly created StringValueMap.
|
440 | */
|
441 | static fromTuplesArray(tuples: any[]): StringValueMap;
|
442 | /**
|
443 | * Parses semicolon-separated key-value pairs and returns them as a StringValueMap.
|
444 | *
|
445 | * @param line semicolon-separated key-value list to initialize StringValueMap.
|
446 | * @returns a newly created StringValueMap.
|
447 | */
|
448 | static fromString(line: string): StringValueMap;
|
449 | /**
|
450 | * Creates a new AnyValueMap by merging two or more maps.
|
451 | * Maps defined later in the list override values from previously defined maps.
|
452 | *
|
453 | * @param maps an array of maps to be merged
|
454 | * @returns a newly created AnyValueMap.
|
455 | */
|
456 | static fromMaps(...maps: any[]): StringValueMap;
|
457 | }
|