Alias canFactoryInstanceFactory

Checks if a structure has factoryContainer method for InstanceFactory.

alias canFactoryInstanceFactory(alias T, Z, string property = "__ctor") = canFactoryInstanceFactory!(typeof(T),Z,property);
template canFactoryInstanceFactory(T, Z, string property = "__ctor") ;

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.

Alias canFactoryInstanceFactory

Template canFactoryInstanceFactory

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;

    }
}

Parameters

NameDescription
T the structure to be tested for interface compatibility
Z the type of object that T has to instantiate

Returns

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