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
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
abstract This withAlias(Str alias)
Overrides service aliases with the given ID.
- withAliasType
abstract This withAliasType(Type aliasType)
Overrides service alias types with the given type.
- withAliasTypes
abstract This withAliasTypes(Type[]? aliasTypes)
Overrides service alias types with the given list.
- withAliases
abstract This withAliases(Str[]? aliases)
Overrides service aliases with the given list.
- withBuilder
abstract This withBuilder(|Scope->Obj?? serviceBuilder)
Overrides the service builder func.
- withCtorArgs
abstract This withCtorArgs(Obj?[]? args)
Overrides the service ctor args.
- withFieldVals
abstract This withFieldVals([Field:Obj?]? fieldVals)
Overrides the service field vals.
- withImplType
abstract This withImplType(Type? implType)
Overrides the service implementation.
- withOverrideId
abstract This withOverrideId(Str overrideId)
Sets an override ID so others may override this override.
// override the sheep serviceregBuilder.overrideService("acme::Sheep").withOverrideId("wolf").withImplType(WolfImpl#)// override the wolf overrideregBuilder.overrideService("wolf").withOverrideId("bear").withImplType(BearImpl#)// override the bear overrideregBuilder.overrideService("bear").withOverrideId("frog").withImplType(FrogImpl#)- withScope
abstract This withScope(Str scope)
Overrides service scopes with the given scope ID.
- withScopes
abstract This withScopes(Str[]? scopes)
Overrides service scopes with the given scope list.