TypeReflector class

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.

See TypeDescriptor

Example

var descriptor =  TypeDescriptor('MyObject', 'mylibrary');
Typeeflector.getTypeByDescriptor(descriptor);
var myObj = TypeReflector.createInstanceByDescriptor(descriptor);

TypeDescriptor.isPrimitive(myObject); 		// Result: false
TypeDescriptor.isPrimitive(123);				// Result: true

Constructors

TypeReflector()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

createInstance(String name, String? library, List args) → dynamic
Creates an instance of an object type specified by its name and library where it is defined.
createInstanceByDescriptor(TypeDescriptor descriptor, List args) → dynamic
Creates an instance of an object type specified by type descriptor.
createInstanceByType(Type? type, List? args) → dynamic
Creates an instance of an object type.
getType(String name, [String? library]) Type?
Gets object type by its name and library where it is defined.
getTypeByDescriptor(TypeDescriptor descriptor) Type?
Gets object type by type descriptor.
isPrimitive(dynamic value) bool
Checks if value has primitive type.