Function factoryMethodBasedFactory

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

auto auto factoryMethodBasedFactory(T, string method, W, Args...) (
  Locator!() locator,
  auto ref W factoryMethod,
  auto ref Args args
)
if (isNonStaticMethodCompatible!(T, method, Args) && (is(W : T) || is(W : RuntimeReference)));

auto auto factoryMethodBasedFactory(T, string method, Args...) (
  Locator!() locator,
  auto ref Args args
)
if (isStaticMethodCompatible!(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.

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.