classafIoc::OrderedConfig

sys::Obj
  afIoc::OrderedConfig

Passed into module contribution methods to allow the method to, err, contribute!

A service can collect contributions in three different ways:

  • As an unordered list of values
  • As an ordered list of values
  • As a map of keys and values

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 the type.

addOrdered

Source

Void addOrdered(Str id, Obj? object, Str[] constraints := Str[])Str#.emptyList()

Adds an ordered object to a service's contribution. Each object has a unique id (case insensitive) that is used by the constraints for ordering. Each constraint must start with the prefix BEFORE: or AFTER:.

config.addOrdered("Breakfast", eggs)
config.addOrdered("Lunch", ham, ["AFTER: breakfast", "BEFORE: dinner"])
config.addOrdered("Dinner", pie)

Configuration contributions are ordered across modules.

addOrderedPlaceholder

Source

Void addOrderedPlaceholder(Str id, Str[] constraints := Str[])Str#.emptyList()

Adds a placeholder. Placeholders are empty configurations used to aid ordering.

config.addPlaceholder("End")
config.addOrdered("Wot", ever, ["BEFORE: end"])
config.addOrdered("Last", last, ["AFTER: end"])

Placeholders do not appear in the the resulting ordered list.

@since 1.2

addOverride

Source

Void addOverride(Str existingId, Str newId, Obj? newObject, Str[] newConstraints := (Str[])[,])

Overrides a contributed ordered object. The original object must exist.

Note: Unordered configurations can not be overridden.

@since 1.2

addUnordered

Source

Void addUnordered(Obj object)

Adds an unordered object to a service's configuration.

addUnorderedAll

Source

Void addUnorderedAll(Obj[] objects)

Adds all the unordered objects to a service's configuration.

autobuild

Source

Obj autobuild(Type type, Obj?[] ctorArgs := Obj#.emptyList())

A helper method that instantiates an object, injecting any dependencies. See Registry.autobuild.

toStr

Source

virtual override Str toStr()