factoryMethodBasedFactory

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

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.

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

Parameters

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.

Meta