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

Helper class to perform object type introspection and object instantiation. More...

Static Public Member Functions

static Type GetType (string name, string library)
 Gets object type by its name and library where it is defined. More...
 
static Type GetType (string name)
 Gets object type by its name. More...
 
static Type GetTypeByDescriptor (TypeDescriptor type)
 Gets object type by type descriptor. More...
 
static object CreateInstanceByType (Type type, params object[] args)
 Creates an instance of an object type. More...
 
static object CreateInstance (string name, string library, params object[] args)
 Creates an instance of an object type specified by its name and library where it is defined. More...
 
static object CreateInstance (string name, params object[] args)
 Creates an instance of an object type specified by its name. More...
 
static object CreateInstanceByDescriptor (TypeDescriptor type, params object[] args)
 Creates an instance of an object type specified by type descriptor. More...
 

Detailed Description

Helper class to perform object type introspection and object instantiation.

This class has symmetric implementation across all languages supported by Pip.Services toolkit and used to support dynamic data processing.

Because all languages have different casing and case sensitivity rules, this TypeReflector treats all type names as case insensitive.

var descriptor = new TypeDescriptor("MyObject", "mylibrary");
TypeReflector.GetTypeByDescriptor(descriptor);
var myObj = TypeReflector.createInstanceByDescriptor(descriptor);

See TypeDescriptor

Member Function Documentation

◆ CreateInstance() [1/2]

static object PipServices3.Commons.Reflect.TypeReflector.CreateInstance ( string  name,
string  library,
params object []  args 
)
static

Creates an instance of an object type specified by its name and library where it is defined.

Parameters
namean object type name.
librarya library (module) where object type is defined.
argsarguments for the object constructor.
Returns
the created object instance.

◆ CreateInstance() [2/2]

static object PipServices3.Commons.Reflect.TypeReflector.CreateInstance ( string  name,
params object []  args 
)
static

Creates an instance of an object type specified by its name.

Parameters
namean object type name.
argsarguments for the object constructor.
Returns
the created object instance.

◆ CreateInstanceByDescriptor()

static object PipServices3.Commons.Reflect.TypeReflector.CreateInstanceByDescriptor ( TypeDescriptor  type,
params object []  args 
)
static

Creates an instance of an object type specified by type descriptor.

Parameters
typea type descriptor that points to an object type
argsarguments for the object constructor.
Returns
the created object instance.

◆ CreateInstanceByType()

static object PipServices3.Commons.Reflect.TypeReflector.CreateInstanceByType ( Type  type,
params object []  args 
)
static

Creates an instance of an object type.

Parameters
typean object type (factory function) to create.
argsarguments for the object constructor.
Returns
the created object instance.

◆ GetType() [1/2]

static Type PipServices3.Commons.Reflect.TypeReflector.GetType ( string  name,
string  library 
)
static

Gets object type by its name and library where it is defined.

Parameters
namean object type name.
librarya library where the type is defined
Returns
the object type or null is the type wasn't found.

◆ GetType() [2/2]

static Type PipServices3.Commons.Reflect.TypeReflector.GetType ( string  name)
static

Gets object type by its name.

Parameters
namean object type name.
Returns
the object type or null is the type wasn't found.

◆ GetTypeByDescriptor()

static Type PipServices3.Commons.Reflect.TypeReflector.GetTypeByDescriptor ( TypeDescriptor  type)
static

Gets object type by type descriptor.

Parameters
typea type descriptor that points to an object type
Returns
the object type or null is the type wasn't found.

See GetType(string, string), TypeDescriptor


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