Factory class
Basic component factory that creates components using registered types and factory functions.
Example
var factory = Factory();
factory.registerAsType(
Descriptor('mygroup', 'mycomponent1', 'default', '*', '1.0'),
MyComponent1
);
factory.register(
Descriptor('mygroup', 'mycomponent2', 'default', '*', '1.0'),
(locator) => {
return MyComponent2();
}
);
factory.create(Descriptor('mygroup', 'mycomponent1', 'default', 'name1', '1.0'))
factory.create(Descriptor('mygroup', 'mycomponent2', 'default', 'name2', '1.0'))
See https://rawgit.com/pip-services-node/pip-services3-commons-node/master/doc/api/classes/refer.descriptor.html Descriptor
See IFactory
Constructors
- Factory()
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
canCreate(
dynamic locator) → dynamic -
Checks if this factory is able to create component by given locator. [...]
override
-
create(
dynamic locator) → dynamic -
Creates a component identified by given locator. [...]
override
-
register(
dynamic locator, dynamic factory_(dynamic locator)) → void - Registers a component using a factory method. [...]
-
registerAsType(
dynamic locator dynamic type) → void - Registers a component using its type (a constructor function). [...]
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited