canFactoryInstanceFactory

Checks if a structure has factoryContainer method for InstanceFactory.

This static interface is used to find annotations that can provide a InstanceFactory for GenericFactory to be used by it to instantiate the object. The @constructor annotation implements this annotation and therefore it is possible to use it to mark a constructor to be used for object construction. Any annotation implementing this interface can be used by annotation system to configure objects.

  1. template canFactoryInstanceFactory(alias T, Z, string property = "__ctor")
    template canFactoryInstanceFactory (
    Z
    string property = "__ctor"
    ) {}
  2. template canFactoryInstanceFactory(T, Z, string property = "__ctor")

Members

Aliases

canFactoryInstanceFactory
alias canFactoryInstanceFactory = canFactoryInstanceFactory!(typeof(T), Z, property)
Undocumented in source.

Parameters

T

the structure to be tested for interface compatibility

Z

the type of object that T has to instantiate

Return Value

true in case of structure implementing static interface, false otherwise.

Examples

struct SetterAnnotation(Args...) {
    Tuple!Args args;

    this(Args args) {
        this.args = args;
    }

    InstanceFactory!T factoryContainer(T, string property)(Locator!() locator) {
        auto constructor = new ConstructorBasedFactory!(T, Args)(args.expand);
        constructor.locator = locator;

        return constructor;

    }
}

Meta