mixinafIoc::Configuration
afIoc::Configuration
@Js
Use to add create and override service configuration contributions.
Every service may receive a list or ordered map of values; called its configuration. Any (external) module may contribute to this using in a configuration method.
The service defines the type of contribution by declaring a parameterised list or map in its ctor or builder method. Contributions must be compatible with this type. Example, the service SeaLions may define a configuration map of [Str:Penguin] with the following ctor:
class SeaLion {
    new make(Str:Penguin foodGroups) {
        ...
    }
}
Contribute to the SeaLion service in the AppModule:
const class AppModule {
    Void defineServices(RegistryBuilder bob) {
        bob.addService(SeaLion#)
    }
    @Contribute { serviceType=SeaLion# }
    Void contributeSeaLion(Configuration config) {
        config["kevin"] = Penguin()
    }
} 
Or use RegistryBuilder:
bob := RegistryBuilder()
bob.addService(
bob.contributeToServiceType(SeaLion#) |Configuration config| {
    config["kevin"] = Penguin()
}
- add
- abstract Constraints add(Obj value)- Adds a value to the service configuration with optional ordering constraints. - Because the keys of added values are unknown, they cannot be overridden. For that reason it is advised to use - set()instead.- valueis coerced to the service's contribution type.- config.add(value) 
- addPlaceholder
- abstract Constraints addPlaceholder(Str key)- Adds a placeholder. Placeholders are empty configurations used to aid the ordering of actual values: - config.placeholder("end") config.set("foo", val1).before("end") config.set("bar", val2).after("end")- While not very useful in the same contribution method, they become very powerful when used across multiple modules and pods. - Placeholders do not appear in the the resulting configuration and are never seen by the end service. 
- build
- Obj build(Type type, Obj?[]? ctorArgs := null, [Field:Obj?]? fieldVals := null)- Convenience method for Scope.build; builds an instance of the given - Typeinjecting in all dependencies.
- inOrder
- abstract Constraints inOrder(|This f)- Defines a block where defined contributions are kept in the same order. The block itself may be ordered before and / or after other contributions: - config.inOrder { config["b-1"] = 1 config["b-2"] = 1 config.addPlaceholder("separator") config["b-3"] = 1 }.before("c-1").after("a-1")
- overrideValue
- abstract Constraints overrideValue(Obj existingKey, Obj? newValue, Obj? newKey := null)- Overrides and replaces a contributed value. The existing key must exist. - Note that when overriding, all existing ordering constraints are cleared and must be re-set. - existingKeyis the id / key of the value to be replaced. It may have been initially provided by- set()or have be the- newKeyof a previous override.- newKeydoes not appear in the the resulting configuration and is never seen by the end service. It is only used as reference to this override, so this override itself may be overridden. 3rd party libraries, when overriding, should always supply a- newKey.- newKeymay be any- Objinstance but sane and intelligent people will always pass in a- Str.- newValueis coerced to the service's contribution type.
- remove
- abstract Void remove(Obj existingKey, Obj? newKey := null)- A special kind of override whereby, should this be the last override applied, the value is removed from the configuration. - existingKeyis the id / key of the value to be replaced. It may have been initially provided by- set()or have be the- newKeyof a previous override.- newKeydoes not appear in the the resulting configuration and is never seen by the end service. It is only used as reference to this override, so this override itself may be overridden. 3rd party libraries, when overriding, should always supply a- newKey.- newKeymay be any- Objinstance but sane and intelligent people will always pass in a- Str.
- scope
- abstract Scope scope()- Returns the active scope. 
- set
- @Operator
 abstract Constraints set(Obj key, Obj? value)- Sets a key / value pair to the service configuration with optional ordering constraints. - If the end service configuration is a List, then the keys are discarded and only the values passed use. In this case, typically - Strkeys are used for ease of use when overriding / adding constraints.- Configuration contributions are ordered across modules. - keyand- valueare coerced to the service's contribution type.- config.set("key", value) config["key"] = value