ValueInjector

Interface which should be implemented by value injectors.

Each value injector injects one specific type. The type can be any primitive type or that of a struct. While class types are also supported, value injectors are not intended for them.

Note that value injectors are also autowired before being used. Values within dependencies of a value injector are not injected. Neither are values within the value injector itself.

Value injection is not supported for constructor injection.

interface ValueInjector (
Type
) {}

Members

Functions

get
Type get(string key)

Get a value from the injector by key.

Examples

class MyIntInjector : ValueInjector!int {
    public override int get(string key) { ... }
}

// In order to make the container use your injector, register it by interface:
container.register!(ValueInjector!int, MyIntInjector);

Meta