UNPKG

2.56 kBTypeScriptView Raw
1/**
2 * Helper class to perform property introspection and dynamic reading.
3 *
4 * It is similar to [[ObjectReader]] but reads properties recursively
5 * through the entire object graph. Nested property names are defined
6 * using dot notation as "object.subobject.property"
7 *
8 * @see [[PropertyReflector]]
9 * @see [[ObjectReader]]
10 */
11export declare class RecursiveObjectReader {
12 private static performHasProperty;
13 /**
14 * Checks recursively if object or its subobjects has a property with specified name.
15 *
16 * The object can be a user defined object, map or array.
17 * The property name correspondently must be object property,
18 * map key or array index.
19 *
20 * @param obj an object to introspect.
21 * @param name a name of the property to check.
22 * @returns true if the object has the property and false if it doesn't.
23 */
24 static hasProperty(obj: any, name: string): boolean;
25 private static performGetProperty;
26 /**
27 * Recursively gets value of object or its subobjects property specified by its name.
28 *
29 * The object can be a user defined object, map or array.
30 * The property name correspondently must be object property,
31 * map key or array index.
32 *
33 * @param obj an object to read property from.
34 * @param name a name of the property to get.
35 * @returns the property value or null if property doesn't exist or introspection failed.
36 */
37 static getProperty(obj: any, name: string): any;
38 private static isSimpleValue;
39 private static performGetPropertyNames;
40 /**
41 * Recursively gets names of all properties implemented in specified object and its subobjects.
42 *
43 * The object can be a user defined object, map or array.
44 * Returned property name correspondently are object properties,
45 * map keys or array indexes.
46 *
47 * @param obj an objec to introspect.
48 * @returns a list with property names.
49 */
50 static getPropertyNames(obj: any): string[];
51 private static performGetProperties;
52 /**
53 * Get values of all properties in specified object and its subobjects
54 * and returns them as a map.
55 *
56 * The object can be a user defined object, map or array.
57 * Returned properties correspondently are object properties,
58 * map key-pairs or array elements with their indexes.
59 *
60 * @param obj an object to get properties from.
61 * @returns a map, containing the names of the object's properties and their values.
62 */
63 static getProperties(obj: any): any;
64}