1 |
|
2 | import { TypeCode } from '../convert/TypeCode';
|
3 | import { ICloneable } from './ICloneable';
|
4 | import { AnyValueArray } from './AnyValueArray';
|
5 | import { AnyValueMap } from './AnyValueMap';
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | export declare class AnyValue implements ICloneable {
|
29 |
|
30 | value: any;
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 | constructor(value?: any);
|
37 | /**
|
38 | * Gets type code for the value stored in this object.
|
39 | *
|
40 | * @returns type code of the object value.
|
41 | *
|
42 | * @see [[TypeConverter.toTypeCode]]
|
43 | */
|
44 | getTypeCode(): TypeCode;
|
45 | /**
|
46 | * Gets the value stored in this object without any conversions
|
47 | *
|
48 | * @returns the object value.
|
49 | */
|
50 | getAsObject(): any;
|
51 | /**
|
52 | * Sets a new value for this object
|
53 | *
|
54 | * @param value the new object value.
|
55 | */
|
56 | setAsObject(value: any): void;
|
57 | /**
|
58 | * Converts object value into a string or returns null if conversion is not possible.
|
59 | *
|
60 | * @returns string value or null if conversion is not supported.
|
61 | *
|
62 | * @see [[StringConverter.toNullableString]]
|
63 | */
|
64 | getAsNullableString(): string;
|
65 | /**
|
66 | * Converts object value into a string or returns "" if conversion is not possible.
|
67 | *
|
68 | * @returns string value or "" if conversion is not supported.
|
69 | *
|
70 | * @see [[getAsStringWithDefault]]
|
71 | */
|
72 | getAsString(): string;
|
73 | /**
|
74 | * Converts object value into a string or returns default value if conversion is not possible.
|
75 | *
|
76 | * @param defaultValue the default value.
|
77 | * @returns string value or default if conversion is not supported.
|
78 | *
|
79 | * @see [[StringConverter.toStringWithDefault]]
|
80 | */
|
81 | getAsStringWithDefault(defaultValue: string): string;
|
82 | /**
|
83 | * Converts object value into a boolean or returns null if conversion is not possible.
|
84 | *
|
85 | * @returns boolean value or null if conversion is not supported.
|
86 | *
|
87 | * @see [[BooleanConverter.toNullableBoolean]]
|
88 | */
|
89 | getAsNullableBoolean(): boolean;
|
90 | /**
|
91 | * Converts object value into a boolean or returns false if conversion is not possible.
|
92 | *
|
93 | * @returns string value or false if conversion is not supported.
|
94 | *
|
95 | * @see [[getAsBooleanWithDefault]]
|
96 | */
|
97 | getAsBoolean(): boolean;
|
98 | /**
|
99 | * Converts object value into a boolean or returns default value if conversion is not possible.
|
100 | *
|
101 | * @param defaultValue the default value.
|
102 | * @returns boolean value or default if conversion is not supported.
|
103 | *
|
104 | * @see [[BooleanConverter.toBooleanWithDefault]]
|
105 | */
|
106 | getAsBooleanWithDefault(defaultValue: boolean): boolean;
|
107 | /**
|
108 | * Converts object value into an integer or returns null if conversion is not possible.
|
109 | *
|
110 | * @returns integer value or null if conversion is not supported.
|
111 | *
|
112 | * @see [[IntegerConverter.toNullableInteger]]
|
113 | */
|
114 | getAsNullableInteger(): number;
|
115 | /**
|
116 | * Converts object value into an integer or returns 0 if conversion is not possible.
|
117 | *
|
118 | * @returns integer value or 0 if conversion is not supported.
|
119 | *
|
120 | * @see [[getAsIntegerWithDefault]]
|
121 | */
|
122 | getAsInteger(): number;
|
123 | /**
|
124 | * Converts object value into a integer or returns default value if conversion is not possible.
|
125 | *
|
126 | * @param defaultValue the default value.
|
127 | * @returns integer value or default if conversion is not supported.
|
128 | *
|
129 | * @see [[IntegerConverter.toIntegerWithDefault]]
|
130 | */
|
131 | getAsIntegerWithDefault(defaultValue: number): number;
|
132 | /**
|
133 | * Converts object value into a long or returns null if conversion is not possible.
|
134 | *
|
135 | * @returns long value or null if conversion is not supported.
|
136 | *
|
137 | * @see [[LongConverter.toNullableLong]]
|
138 | */
|
139 | getAsNullableLong(): number;
|
140 | /**
|
141 | * Converts object value into a long or returns 0 if conversion is not possible.
|
142 | *
|
143 | * @returns string value or 0 if conversion is not supported.
|
144 | *
|
145 | * @see [[getAsLongWithDefault]]
|
146 | */
|
147 | getAsLong(): number;
|
148 | /**
|
149 | * Converts object value into a long or returns default value if conversion is not possible.
|
150 | *
|
151 | * @param defaultValue the default value.
|
152 | * @returns long value or default if conversion is not supported.
|
153 | *
|
154 | * @see [[LongConverter.toLongWithDefault]]
|
155 | */
|
156 | getAsLongWithDefault(defaultValue: number): number;
|
157 | /**
|
158 | * Converts object value into a float or returns null if conversion is not possible.
|
159 | *
|
160 | * @returns float value or null if conversion is not supported.
|
161 | *
|
162 | * @see [[FloatConverter.toNullableFloat]]
|
163 | */
|
164 | getAsNullableFloat(): number;
|
165 | /**
|
166 | * Converts object value into a float or returns 0 if conversion is not possible.
|
167 | *
|
168 | * @returns float value or 0 if conversion is not supported.
|
169 | *
|
170 | * @see [[getAsFloatWithDefault]]
|
171 | */
|
172 | getAsFloat(): number;
|
173 | /**
|
174 | * Converts object value into a float or returns default value if conversion is not possible.
|
175 | *
|
176 | * @param defaultValue the default value.
|
177 | * @returns float value or default if conversion is not supported.
|
178 | *
|
179 | * @see [[FloatConverter.toFloatWithDefault]]
|
180 | */
|
181 | getAsFloatWithDefault(defaultValue: number): number;
|
182 | /**
|
183 | * Converts object value into a double or returns null if conversion is not possible.
|
184 | *
|
185 | * @returns double value or null if conversion is not supported.
|
186 | *
|
187 | * @see [[DoubleConverter.toNullableDouble]]
|
188 | */
|
189 | getAsNullableDouble(): number;
|
190 | /**
|
191 | * Converts object value into a double or returns 0 if conversion is not possible.
|
192 | *
|
193 | * @returns double value or 0 if conversion is not supported.
|
194 | *
|
195 | * @see [[getAsDoubleWithDefault]]
|
196 | */
|
197 | getAsDouble(): number;
|
198 | /**
|
199 | * Converts object value into a double or returns default value if conversion is not possible.
|
200 | *
|
201 | * @param defaultValue the default value.
|
202 | * @returns double value or default if conversion is not supported.
|
203 | *
|
204 | * @see [[DoubleConverter.toDoubleWithDefault]]
|
205 | */
|
206 | getAsDoubleWithDefault(defaultValue: number): number;
|
207 | /**
|
208 | * Converts object value into a Date or returns null if conversion is not possible.
|
209 | *
|
210 | * @returns Date value or null if conversion is not supported.
|
211 | *
|
212 | * @see [[DateTimeConverter.toNullableDateTime]]
|
213 | */
|
214 | getAsNullableDateTime(): Date;
|
215 | /**
|
216 | * Converts object value into a Date or returns current date if conversion is not possible.
|
217 | *
|
218 | * @returns Date value or current date if conversion is not supported.
|
219 | *
|
220 | * @see [[getAsDateTimeWithDefault]]
|
221 | */
|
222 | getAsDateTime(): Date;
|
223 | /**
|
224 | * Converts object value into a Date or returns default value if conversion is not possible.
|
225 | *
|
226 | * @param defaultValue the default value.
|
227 | * @returns Date value or default if conversion is not supported.
|
228 | *
|
229 | * @see [[DateTimeConverter.toDateTimeWithDefault]]
|
230 | */
|
231 | getAsDateTimeWithDefault(defaultValue: Date): Date;
|
232 | /**
|
233 | * Converts object value into a value defined by specied typecode.
|
234 | * If conversion is not possible it returns null.
|
235 | *
|
236 | * @param type the TypeCode that defined the type of the result
|
237 | * @returns value defined by the typecode or null if conversion is not supported.
|
238 | *
|
239 | * @see [[TypeConverter.toNullableType]]
|
240 | */
|
241 | getAsNullableType<T>(type: TypeCode): T;
|
242 | /**
|
243 | * Converts object value into a value defined by specied typecode.
|
244 | * If conversion is not possible it returns default value for the specified type.
|
245 | *
|
246 | * @param typeCode the TypeCode that defined the type of the result
|
247 | * @returns value defined by the typecode or type default value if conversion is not supported.
|
248 | *
|
249 | * @see [[getAsTypeWithDefault]]
|
250 | */
|
251 | getAsType<T>(typeCode: TypeCode): T;
|
252 | /**
|
253 | * Converts object value into a value defined by specied typecode.
|
254 | * If conversion is not possible it returns default value.
|
255 | *
|
256 | * @param typeCode the TypeCode that defined the type of the result
|
257 | * @param defaultValue the default value
|
258 | * @returns value defined by the typecode or type default value if conversion is not supported.
|
259 | *
|
260 | * @see [[TypeConverter.toTypeWithDefault]]
|
261 | */
|
262 | getAsTypeWithDefault<T>(typeCode: TypeCode, defaultValue: T): T;
|
263 | /**
|
264 | * Converts object value into an AnyArray or returns empty AnyArray if conversion is not possible.
|
265 | *
|
266 | * @returns AnyArray value or empty AnyArray if conversion is not supported.
|
267 | *
|
268 | * @see [[AnyValueArray.fromValue]]
|
269 | */
|
270 | getAsArray(): AnyValueArray;
|
271 | /**
|
272 | * Converts object value into AnyMap or returns empty AnyMap if conversion is not possible.
|
273 | *
|
274 | * @returns AnyMap value or empty AnyMap if conversion is not supported.
|
275 | *
|
276 | * @see [[AnyValueMap.fromValue]]
|
277 | */
|
278 | getAsMap(): AnyValueMap;
|
279 | /**
|
280 | * Compares this object value to specified specified value.
|
281 | * When direct comparison gives negative results it tries
|
282 | * to compare values as strings.
|
283 | *
|
284 | * @param obj the value to be compared with.
|
285 | * @returns true when objects are equal and false otherwise.
|
286 | */
|
287 | equals(obj: any): boolean;
|
288 | /**
|
289 | * Compares this object value to specified specified value.
|
290 | * When direct comparison gives negative results it converts
|
291 | * values to type specified by type code and compare them again.
|
292 | *
|
293 | * @param obj the value to be compared with.
|
294 | * @returns true when objects are equal and false otherwise.
|
295 | *
|
296 | * @see [[TypeConverter.toType]]
|
297 | */
|
298 | equalsAsType<T>(type: TypeCode, obj: any): boolean;
|
299 | /**
|
300 | * Creates a binary clone of this object.
|
301 | *
|
302 | * @returns a clone of this object.
|
303 | */
|
304 | clone(): any;
|
305 | /**
|
306 | * Gets a string representation of the object.
|
307 | *
|
308 | * @returns a string representation of the object.
|
309 | *
|
310 | * @see [[StringConverter.toString]]
|
311 | */
|
312 | toString(): any;
|
313 | /**
|
314 | * Gets an object hash code which can be used to optimize storing and searching.
|
315 | *
|
316 | * @returns an object hash code.
|
317 | */
|
318 | hashCode(): number;
|
319 | }
|