multibind: Aggregates multiple factories under one key

Description Usage Arguments Value Examples

Description

Aggregates multiple factories under one key

Usage

1
2
multibind(key, scope = default, combine = function(this, parent)
  base::c(this, parent), binder = .binder)

Arguments

key

injectable bean identifier

scope

of the bean, wraps the injected factory call specifying provisioning strategy, if omitted a new bean instance will be provisioned each time injection is requested; injectoR also ships with with the singleton scope which will provide once and cache the bean for subsequent calls. Interface allows for custom scoping, the scope parameter must be a function accepting key (name) and the provider - the wrapped injected factory call - a function accepting no parameters responsible for actual provisioning

combine

aggregation procedure for combination of context and inherited values, a function accepting a list of injectable values from the current binder context and a no argument function to retrieve values of the parent context; if omitted will the binding will aggregate all values

binder

for this binding, if omitted the binding is added to the root binder

Value

a function accepting one or more factories for adding elements to the binding; naming the factories will result in named values injected; optionally accepts a scope for the bindings, if omitted defaults to provide on injection; please be aware that the scope is called without key for unnamed multibinding

Examples

1
multibind ('keys', binder = binder ()) (function () 'skeleton')

dfci-cccb/injectoR documentation built on May 15, 2019, 5:12 a.m.