mixinafIoc::ServiceOverrideBuilder

afIoc::ServiceOverrideBuilder

@Js

Use to override definitions of an IoC service.

overrideBuilder := regBuilder.overrideService("acme::Sheep")
overrideBuilder
    .withImplType(WolfImpl#)
    .withCtorVals(["teeth"])
    .withScope("root")
optional

Source

abstract This optional(Bool optional := true)

Marks this override as optional. That is, should the service you're attempting to override not exist, no errors are thrown and this override is silently ignored.

Useful for overriding 3rd party libraries that may not be part of the current project.

withAlias

Source

abstract This withAlias(Str alias)

Overrides service aliases with the given ID.

withAliasType

Source

abstract This withAliasType(Type aliasType)

Overrides service alias types with the given type.

withAliasTypes

Source

abstract This withAliasTypes(Type[]? aliasTypes)

Overrides service alias types with the given list.

withAliases

Source

abstract This withAliases(Str[]? aliases)

Overrides service aliases with the given list.

withBuilder

Source

abstract This withBuilder(|Scope->Obj?? serviceBuilder)

Overrides the service builder func.

withCtorArgs

Source

abstract This withCtorArgs(Obj?[]? args)

Overrides the service ctor args.

withFieldVals

Source

abstract This withFieldVals([Field:Obj?]? fieldVals)

Overrides the service field vals.

withImplType

Source

abstract This withImplType(Type? implType)

Overrides the service implementation.

withOverrideId

Source

abstract This withOverrideId(Str overrideId)

Sets an override ID so others may override this override.

// override the sheep service
regBuilder.overrideService("acme::Sheep").withOverrideId("wolf").withImplType(WolfImpl#)

// override the wolf override
regBuilder.overrideService("wolf").withOverrideId("bear").withImplType(BearImpl#)

// override the bear override
regBuilder.overrideService("bear").withOverrideId("frog").withImplType(FrogImpl#)
withScope

Source

abstract This withScope(Str scope)

Overrides service scopes with the given scope ID.

withScopes

Source

abstract This withScopes(Str[]? scopes)

Overrides service scopes with the given scope list.