Class FactoryMethodBasedFactory

Instantiates an aggregate using a method from other aggregate (factory method pattern).

class FactoryMethodBasedFactory(T, string method, W, Args...)
  
if ((is(W : RuntimeReference) || is(W : T)) && isMethodCompatible!(T, method, Args) && isAggregateType!(ReturnType!(getCompatibleOverload!(T, method, Args))));

Encapsulates construction of aggregate using factory method. Arguments that are references, will be replaced with data extracted from locator, and passed to factory's method. In case when method is not static member, the algorithm will use an instantiaton of factory passed to it, or extracted from locator if a reference is passed.

Methods

NameDescription
factorySee InstanceFactory interface

Parameters

NameDescription
T factory that is used to instantiate aggregate using it's method
method the name of method used to instantiate aggregate
W the factory T, or a LocatorReference to the factory.
Args type tuple of arguments passed to factory.