Pip-Services-Commons-Dotnet
Static Public Member Functions | Static Private Member Functions | List of all members
PipServices3.Commons.Reflect.RecursiveObjectReader Class Reference

Helper class to perform property introspection and dynamic reading. More...

Static Public Member Functions

static bool HasProperty (object obj, string name)
 Checks recursively if object or its subobjects has a property with specified name. More...
 
static object GetProperty (object obj, string name)
 Recursively gets value of object or its subobjects property specified by its name. The object can be a user defined object, map or array.The property name correspondently must be object property, map key or array index. More...
 
static IList< string > GetPropertyNames (object obj)
 Recursively gets names of all properties implemented in specified object and its subobjects. More...
 
static IDictionary< string, object > GetProperties (object obj)
 Get values of all properties in specified object and its subobjects and returns them as a map. More...
 

Static Private Member Functions

static bool PerformHasProperty (object obj, string[] names, int nameIndex)
 
static object PerformGetProperty (object obj, string[] names, int nameIndex)
 
static bool IsSimpleValue (object value)
 
static void PerformGetPropertyNames (object obj, string path, IList< string > result, IList< object > cycleDetect)
 
static void PerformGetProperties (object obj, string path, IDictionary< string, object > result, ICollection< object > cycleDetect)
 

Detailed Description

Helper class to perform property introspection and dynamic reading.

It is similar to ObjectReader but reads properties recursively through the entire object graph.Nested property names are defined using dot notation as "object.subobject.property"

See PropertyReflector, ObjectReader

Member Function Documentation

◆ GetProperties()

static IDictionary<string, object> PipServices3.Commons.Reflect.RecursiveObjectReader.GetProperties ( object  obj)
static

Get values of all properties in specified object and its subobjects and returns them as a map.

The object can be a user defined object, map or array.Returned properties correspondently are object properties, map key-pairs or array elements with their indexes.

Parameters
objan object to get properties from.
Returns
a map, containing the names of the object's properties and their values.

◆ GetProperty()

static object PipServices3.Commons.Reflect.RecursiveObjectReader.GetProperty ( object  obj,
string  name 
)
static

Recursively gets value of object or its subobjects property specified by its name. The object can be a user defined object, map or array.The property name correspondently must be object property, map key or array index.

Parameters
objan object to read property from.
namea name of the property to get.
Returns
the property value or null if property doesn't exist or introspection failed.

◆ GetPropertyNames()

static IList<string> PipServices3.Commons.Reflect.RecursiveObjectReader.GetPropertyNames ( object  obj)
static

Recursively gets names of all properties implemented in specified object and its subobjects.

The object can be a user defined object, map or array.Returned property name correspondently are object properties, map keys or array indexes.

Parameters
objan objec to introspect.
Returns
a list with property names.

◆ HasProperty()

static bool PipServices3.Commons.Reflect.RecursiveObjectReader.HasProperty ( object  obj,
string  name 
)
static

Checks recursively if object or its subobjects has a property with specified name.

The object can be a user defined object, map or array.The property name correspondently must be object property, map key or array index.

Parameters
objan object to introspect.
namea name of the property to check.
Returns
true if the object has the property and false if it doesn't.

The documentation for this class was generated from the following file: