izumi.distage.model.definition
Members list
Packages
Type members
Classlikes
Selection of active choices among those available in an Activation Axis
Selection of active choices among those available in an Activation Axis
import distage.{Activation, Repo, Mode}
Activation(
Repo -> Repo.Prod,
Mode -> Mode.Test,
)
Attributes
- See also
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass AnyValtrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Activation.type
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait ImplBindingclass SetElementBindingclass SingletonBinding[K]trait SetBindingclass EmptySetBinding[K]
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
An attachment that can be added to a binding using its .tagged method
An attachment that can be added to a binding using its .tagged method
Attributes
- Note
-
an inheritor of BindingTag must be an immutable case class and all of its fields must be used in
equals/hashCode. - Companion
- object
- Supertypes
- Known subtypes
- Self type
-
Product
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
BindingTag.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Bindings.type
Attributes
- Companion
- object
- Supertypes
-
trait BootstrapModuletrait ModuleBasetrait CachedHashcodeclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
trait ModuleDefDSLtrait TagsDSLtrait IncludesDSLtrait BootstrapContextModuletrait BootstrapModuletrait ModuleBasetrait CachedHashcodeclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
trait BootstrapContextModuletrait BootstrapModuleDefclass BootstrapPlatformModuleclass GraphDumpBootstrapModuleobject GraphDumpBootstrapModuleclass AutoSetModuleclass BootstrapPluginDef[T]class LogstageModuletrait BootstrapPluginShow all
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
BootstrapModule.type
Attributes
- Supertypes
-
trait ModuleDefDSLtrait TagsDSLtrait IncludesDSLtrait BootstrapModuletrait ModuleBasetrait CachedHashcodeclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class BootstrapPlatformModuleclass GraphDumpBootstrapModuleobject GraphDumpBootstrapModuleclass AutoSetModuleclass BootstrapPluginDef[T]class LogstageModuleShow all
Annotation for summoning named instances.
Annotation for summoning named instances.
Example:
val module = new ModuleDef {
make[Int].named("three").from(3)
make[Int].named("five").from(5)
}
Injector().produce(module).run {
(five: Int @Id("five"), three: Int @Id("three")) =>
assert(5 == five)
assert(3 == three)
}
Attributes
- Note
-
javax.inject.Namedannotation is also supported - Supertypes
-
trait DIStageAnnotationtrait TypeConstrainttrait StaticAnnotationclass Annotationclass Objecttrait Matchableclass AnyShow all
Type of a name for a named instance, which can be any type that implements izumi.distage.model.reflection.IdContract typeclass, e.g. String
Type of a name for a named instance, which can be any type that implements izumi.distage.model.reflection.IdContract typeclass, e.g. String
Example:
implicit val idInt: IdContract[Int] = new IdContract.IdContractImpl[Int]
val module = new ModuleDef {
make[Int].named(3).from(3)
make[Int].named(5).from(5)
}
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Identifier.type
Attributes
- Companion
- object
- Supertypes
-
trait CachedProductHashcodetrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait DirectImplDefclass InstanceImplclass ProviderImplclass ReferenceImplclass SubcontextImplDeftrait RecursiveImplDefclass EffectImplclass ResourceImplShow all
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LocatorDef.type
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
LocatorPrivacy.type
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
trait ModuleDefclass AppConfigModuletrait ConfigModuleDeftrait ConfigModuleDefNoMetaclass CassandraDockerModule[F]class ElasticMQDockerModule[F]class PostgresDockerModule[F]class DockerSupportModule[F]class DistagePlatformModuleobject LogstageFailureHandlerModuletrait CatsIOSupportModuleobject CatsIOSupportModuletrait IdentitySupportModuleobject IdentitySupportModuleclass ZIOCatsEffectInstancesModule[R]class PluginDef[T]class BundledRolesModule[F]trait RoleModuleDefclass RoleAppBootArgsModuleclass RoleAppBootConfigModuleclass RoleAppBootLoggerModuleclass RoleAppBootModule[F]class TestRuntimeModule[F]class TestkitRunnerModule[F]class LogIOModule[F]class LogIO2Module[F]class LogIO3Module[F]Show all
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
trait BootstrapModuletrait BootstrapContextModuletrait BootstrapModuleDefclass BootstrapPlatformModuleclass GraphDumpBootstrapModuleobject GraphDumpBootstrapModuleclass AutoSetModuleclass BootstrapPluginDef[T]class LogstageModuletrait BootstrapPlugintrait Moduletrait ModuleDefclass AppConfigModuletrait ConfigModuleDeftrait ConfigModuleDefNoMetaclass CassandraDockerModule[F]class ElasticMQDockerModule[F]class PostgresDockerModule[F]class DockerSupportModule[F]class DistagePlatformModuleobject LogstageFailureHandlerModuletrait CatsIOSupportModuleobject CatsIOSupportModuletrait IdentitySupportModuleobject IdentitySupportModuleclass ZIOCatsEffectInstancesModule[R]class PluginDef[T]class BundledRolesModule[F]trait RoleModuleDefclass RoleAppBootArgsModuleclass RoleAppBootConfigModuleclass RoleAppBootLoggerModuleclass RoleAppBootModule[F]class TestRuntimeModule[F]class TestkitRunnerModule[F]class LogIOModule[F]class LogIO2Module[F]class LogIO3Module[F]trait PluginBaseShow all
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ModuleBase.type
DSL for defining module Bindings.
DSL for defining module Bindings.
Example:
class Program[F[_]: TagK] extends ModuleDef {
make[TaglessProgram[F]]
}
object TryInterpreters extends ModuleDef {
make[Validation.Handler[Try]].from(tryValidationHandler)
make[Interaction.Handler[Try]].from(tryInteractionHandler)
}
// Combine modules into a full program
val TryProgram = new Program[Try] ++ TryInterpreters
Singleton bindings:
make[X]= create X using its constructormakeTrait[X]= create an abstract class or a traitXusing izumi.distage.constructors.TraitConstructor (Auto-Traits feature)makeFactory[X]= create a "factory-like" abstract class or a traitXusing izumi.distage.constructors.FactoryConstructor (Auto-Factories feature)make[X].from[XImpl]= bind X to its subtype XImpl using XImpl's constructormake[X].fromTrait[XImpl]= bind X to its abstract class or a trait subtype XImpl, deriving constructor using izumi.distage.constructors.TraitConstructor (Auto-Traits feature)make[X].fromFactory[XImpl]= bind X to its "factory-like" abstract class or a trait subtype XImpl, deriving constructor using izumi.distage.constructors.FactoryConstructor (Auto-Factories feature)make[X].from(myX)= bind X to an already existing instancemyXmake[X].from { y: Y => new X(y) }= bind X to an instance of X constructed by a given Functoid requesting an Y parametermake[X].from { y: Y @Id("special") => new X(y) }= bind X to an instance of X constructed by a given Functoid, requesting a named "special" Y parametermake[X].from { y: Y => new X(y) }.annotateParameterY = bind X to an instance of X constructed by a given Functoid, requesting a named "special" Y parametermake[X].named("special")= bind a named instance of X. It can then be summoned using Id annotation.make[X].using[X]("special")= bind X to refer to another already bound named instance at key[X].named("special")make[X].fromEffect(X.create[F]: F[X])= create X using a purely-functional effectX.createinFmonadmake[X].fromResource(X.resource[F]: Lifecycle[F, X])= create X using aLifecyclevalue specifying its creation and destruction lifecyclemake[X].from[XImpl].modify(fun(_))= Create X using XImpl's constructor and applyfunto the resultmake[X].from[XImpl].modifyBy(_.flatAp { (c: C, d: D) => (x: X) => c.method(x, d) })= Create X using XImpl's constructor and modify itsFunctoidusing the provided lambda - in this case by summoning additionalC&Ddependencies and applyingC.methodtoX
Set bindings:
many[X].add[X1].add[X2]= bind aSetof X, and add subtypes X1 and X2 created via their constructors to it. Sets can be bound in multiple different modules. All the elements of the same set in different modules will be joined together.many[X].add(x1).add(x2)= add instances x1 and x2 to aSet[X]many[X].add { y: Y => new X1(y).add { y: Y => X2(y) }= add instances of X1 and X2 constructed by a given Provider functionmany[X].named("special").add[X1]= create a named set of X, all the elements of it are added to this named set.many[X].ref[XImpl]= add a reference to an already existing binding of XImpl to a set of X'smany[X].ref[X]("special")= add a reference to an existing named binding of X to a set of X's
Mutators:
modify[X](fun(_))= add a modifier applyingfunto the value bound atX(mutator application order is unspecified)modify[X].by(_.flatAp { (c: C, d: D) => (x: X) => c.method(x, d) })= add a modifier, applying the provided lambda to aFunctoidretrievingX- in this case by summoning additionalC&Ddependencies and applyingC.methodtoX
Tags:
make[X].tagged("t1", "t2)= attach tags to X's binding.many[X].add[X1].tagged("x1tag")= Tag a specific element of X. The tags of sets and their elements are separate.many[X].tagged("xsettag")= Tag the binding of empty Set of X with a tag. The tags of sets and their elements are separate.
Includes:
include(that: ModuleDef)= add all bindings inthatmodule intothismodule
Attributes
- See also
- Supertypes
-
trait ModuleDefDSLtrait TagsDSLtrait IncludesDSLtrait Moduletrait ModuleBasetrait CachedHashcodeclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class AppConfigModuletrait ConfigModuleDeftrait ConfigModuleDefNoMetaclass CassandraDockerModule[F]class ElasticMQDockerModule[F]class PostgresDockerModule[F]class DockerSupportModule[F]class DistagePlatformModuleobject LogstageFailureHandlerModuletrait CatsIOSupportModuleobject CatsIOSupportModuletrait IdentitySupportModuleobject IdentitySupportModuleclass ZIOCatsEffectInstancesModule[R]class PluginDef[T]class BundledRolesModule[F]trait RoleModuleDefclass RoleAppBootArgsModuleclass RoleAppBootConfigModuleclass RoleAppBootLoggerModuleclass RoleAppBootModule[F]class TestRuntimeModule[F]class TestkitRunnerModule[F]class LogIOModule[F]class LogIO2Module[F]class LogIO3Module[F]Show all
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ModuleMake.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
StandardAxis.type
This annotation lets you choose a more specific implementation for a result of factory method other than its return type.
This annotation lets you choose a more specific implementation for a result of factory method other than its return type.
Example:
trait Actor {
def id: UUID
}
trait ActorFactory {
@With[ActorImpl]
def newActor(id: UUID): Actor
}
class ActorImpl(val id: UUID, someDependency: SomeDependency) extends Actor
class SomeDependency
val module = new ModuleDef {
make[ActorFactory]
// generated factory implementation:
//
// make[ActorFactory].from {
// (someDependency: SomeDependency) =>
// new ActorFactory {
// override def newActor(id: UUID): Actor = {
// new ActorImpl(id, someDependency)
// }
// }
// }
}
Attributes
- See also
- Supertypes
-
trait DIStageAnnotationtrait TypeConstrainttrait StaticAnnotationclass Annotationclass Objecttrait Matchableclass AnyShow all
An optional, documentation-only annotation conveying that an abstract class or a trait is the 'actual' implementation of its supertypes and will be bound later in DI with izumi.distage.constructors.TraitConstructor or izumi.distage.constructors.FactoryConstructor
An optional, documentation-only annotation conveying that an abstract class or a trait is the 'actual' implementation of its supertypes and will be bound later in DI with izumi.distage.constructors.TraitConstructor or izumi.distage.constructors.FactoryConstructor
Abstract classes or traits without obvious concrete subclasses may hinder the readability of a codebase, if you still want to use them to avoid writing the full constructor, you may use this annotation to aid the reader in understanding your intentions.
@impl abstract class Impl(
pluser: Pluser
) extends PlusedInt
Attributes
- See also
- Supertypes
-
trait DIStageAnnotationtrait TypeConstrainttrait StaticAnnotationclass Annotationclass Objecttrait Matchableclass AnyShow all