Packages

final class BindDSL[T] extends BindDSLMutBase[T]

Linear Supertypes
BindDSLMutBase[T], BindDSLBase[T, Unit], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BindDSL
  2. BindDSLMutBase
  3. BindDSLBase
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BindDSL(mutableState: SingletonRef, key: TypeKey)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addOp[R](op: SingletonInstruction)(newState: (SingletonRef) ⇒ R): R
    Attributes
    protected
    Definition Classes
    BindDSLMutBase
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def bind(impl: ImplDef): Unit
    Attributes
    protected
    Definition Classes
    BindDSLMutBaseBindDSLBase
  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate() @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  10. final def from[I <: T](function: ProviderMagnet[I])(implicit arg0: reflection.universe.RuntimeDIUniverse.Tag[I]): Unit

    A function that receives its arguments from DI object graph, including named instances via com.github.pshirshov.izumi.distage.model.definition.Id annotation.

    A function that receives its arguments from DI object graph, including named instances via com.github.pshirshov.izumi.distage.model.definition.Id annotation.

    The following syntaxes are supported by extractor macro:

    Inline lambda:

    make[Unit].from {
      i: Int @Id("special") => ()
    }

    Method reference:

    def constructor(@Id("special") i: Int): Unit = ()
    
    make[Unit].from(constructor _)
    
    make[Unit].from(constructor(_))

    Function value (possibly with annotated signature):

    val constructor: (Int @Id("special"), String @Id("special")) => Unit = (_, _) => ()
    
    make[Unit].from(constructor)

    Annotation processing is done by a macro and macros are rarely perfect, Prefer passing an inline lambda such as { x => y } or a method reference such as (method _) or (method(_)) Annotation info may be lost ONLY in a few cases detailed below, though:

    • If an annotated method has been hidden by an intermediate val
    • If an .apply method of a case class is passed when case class _parameters_ are annotated, not their types

    As such, prefer annotating parameter types, not parameters: class X(i: Int @Id("special")) { ... }

    When binding a case class to constructor, prefer passing new X(_) instead of X.apply _ because apply will not preserve parameter annotations from case class definitions:

    case class X(@Id("special") i: Int)
    
    make[X].from(X.apply _) // summons regular Int
    make[X].from(new X(_)) // summons special Int

    HOWEVER, if you annotate the types of parameters instead of their names, apply WILL work:

    case class X(i: Int @Id("special"))
    
    make[X].from(X.apply _) // summons special Int

    Using intermediate vals will lose annotations when converting a method into a function value, prefer using annotated method directly as method reference (method _):

    def constructorMethod(@Id("special") i: Int): Unit = ()
    
    val constructor = constructorMethod _
    
    make[Unit].from(constructor) // Will summon regular Int, not a "special" Int from DI object graph
    Definition Classes
    BindDSLBase
    See also

    com.github.pshirshov.izumi.distage.model.reflection.macros.ProviderMagnetMacro

  11. final def from[I <: T](instance: ⇒ I)(implicit arg0: reflection.universe.RuntimeDIUniverse.Tag[I]): Unit
    Definition Classes
    BindDSLBase
  12. final def from[I <: T](implicit arg0: reflection.universe.RuntimeDIUniverse.Tag[I]): Unit
    Definition Classes
    BindDSLBase
  13. final def fromEffect[F[_], I <: T](function: ProviderMagnet[F[I]])(implicit arg0: reflection.universe.RuntimeDIUniverse.TagK[F], arg1: reflection.universe.RuntimeDIUniverse.Tag[I]): Unit
    Definition Classes
    BindDSLBase
  14. final def fromEffect[F[_], I <: T](instance: F[I])(implicit arg0: reflection.universe.RuntimeDIUniverse.TagK[F], arg1: reflection.universe.RuntimeDIUniverse.Tag[I]): Unit

    Bind to a result of executing a purely-functional effect

    Bind to a result of executing a purely-functional effect

    Example:

    import cats.effect.concurrent.Ref
    import cats.effect.IO
    
    make[Ref[IO, Int]].named("globalMutableCounter").fromEffect(Ref[IO](0))
    Definition Classes
    BindDSLBase
  15. final def fromEffect[F[_], I <: T, EFF <: F[I]](implicit arg0: reflection.universe.RuntimeDIUniverse.TagK[F], arg1: reflection.universe.RuntimeDIUniverse.Tag[I], arg2: reflection.universe.RuntimeDIUniverse.Tag[EFF]): Unit
    Definition Classes
    BindDSLBase
  16. final def fromResource[R0, R <: DIResourceBase[Any, T]](function: ProviderMagnet[R0])(implicit adapt: (ProviderMagnet[R0]) ⇒ ProviderMagnet[R with DIResourceBase[Any, T]], tag: ResourceTag[R]): Unit
    Definition Classes
    BindDSLBase
  17. final def fromResource[R <: DIResourceBase[Any, T]](function: ProviderMagnet[R with DIResourceBase[Any, T]])(implicit tag: ResourceTag[R]): Unit
    Definition Classes
    BindDSLBase
  18. final def fromResource[R <: DIResourceBase[Any, T]](instance: R with DIResourceBase[Any, T])(implicit tag: ResourceTag[R]): Unit
    Definition Classes
    BindDSLBase
  19. final def fromResource[R <: DIResourceBase[Any, T]](implicit tag: ResourceTag[R]): Unit

    Bind to result of acquiring a resource

    Bind to result of acquiring a resource

    The resource will be released when the com.github.pshirshov.izumi.distage.model.Locator holding it is released. Typically, after .use is called on the result of com.github.pshirshov.izumi.distage.model.Producer.produceF

    You can create resources with DIResource.make, by inheriting from DIResource or by converting an existing cats.effect.Resource

    You can bind a cats.effect.Resource directly:

    import cats.effect._
    
    val myResource: Resource[IO, Unit] = Resource.make(IO(println("Acquiring!")))(IO(println("Releasing!")))
    
    make[Unit].from(myResource)
    Definition Classes
    BindDSLBase
    See also

    - cats.effect.Resource: https://typelevel.org/cats-effect/datatypes/resource.html

  20. final def fromValue[I <: T](instance: I)(implicit arg0: reflection.universe.RuntimeDIUniverse.Tag[I]): Unit
    Definition Classes
    BindDSLBase
  21. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  23. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  24. val key: TypeKey
    Attributes
    protected
    Definition Classes
    BindDSLBindDSLMutBase
  25. val mutableState: SingletonRef
    Attributes
    protected
    Definition Classes
    BindDSLBindDSLMutBase
  26. def named[I](name: I)(implicit idContract: reflection.universe.RuntimeDIUniverse.IdContract[I]): BindNamedDSL[T]
  27. def namedByImpl: BindNamedDSL[T]
  28. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  29. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  30. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  31. final def refEffect[F[_], I <: T, EFF <: F[I]](name: String)(implicit arg0: reflection.universe.RuntimeDIUniverse.TagK[F], arg1: reflection.universe.RuntimeDIUniverse.Tag[I], arg2: reflection.universe.RuntimeDIUniverse.Tag[EFF]): Unit
    Definition Classes
    BindDSLBase
  32. final def refEffect[F[_], I <: T, EFF <: F[I]](implicit arg0: reflection.universe.RuntimeDIUniverse.TagK[F], arg1: reflection.universe.RuntimeDIUniverse.Tag[I], arg2: reflection.universe.RuntimeDIUniverse.Tag[EFF]): Unit
    Definition Classes
    BindDSLBase
  33. final def refEffect[F[_], I <: T](name: String)(implicit arg0: reflection.universe.RuntimeDIUniverse.TagK[F], arg1: reflection.universe.RuntimeDIUniverse.Tag[I]): Unit
    Definition Classes
    BindDSLBase
  34. final def refEffect[F[_], I <: T](implicit arg0: reflection.universe.RuntimeDIUniverse.TagK[F], arg1: reflection.universe.RuntimeDIUniverse.Tag[I]): Unit

    Bind to result of executing an effect bound to a key at F[I]

    Bind to result of executing an effect bound to a key at F[I]

    This will execute the effect again for every refEffect binding

    Example:

    import cats.effect.concurrent.Ref
    import cats.effect.IO
    
    make[IO[Ref[IO, Int]]].named("counterFactory").from(Ref[IO](0))
    
    // execute the effect bound above to key `DIKey.get[IO[Ref[IO, Int]]].named("counterFactory")` to create and bind a new Ref
    make[Ref[IO, Int]].named("globalCounter1")
      .refEffect[IO, Ref[IO, Int]]("counterFactory")
    
    make[Ref[IO, Int]].named("globalCounter2")
      .refEffect[IO, Ref[IO, Int]]("counterFactory")
    
    // globalCounter1 and globalCounter2 are two independent mutable references
    Definition Classes
    BindDSLBase
  35. final def refResource[R <: DIResourceBase[Any, T]](name: String)(implicit tag: ResourceTag[R]): Unit
    Definition Classes
    BindDSLBase
  36. final def refResource[R <: DIResourceBase[Any, T]](implicit tag: ResourceTag[R]): Unit

    Bind to a result of acquiring a resource bound to a key at R

    Bind to a result of acquiring a resource bound to a key at R

    This will acquire a NEW resource again for every refResource binding

    Definition Classes
    BindDSLBase
  37. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  38. def tagged(tags: BindingTag*): BindDSL[T]
  39. def toString(): String
    Definition Classes
    AnyRef → Any
  40. def todo(implicit pos: CodePositionMaterializer): Unit
    Definition Classes
    BindDSLMutBase
  41. final def using[I <: T](name: String)(implicit arg0: reflection.universe.RuntimeDIUniverse.Tag[I]): Unit
    Definition Classes
    BindDSLBase
  42. final def using[I <: T](implicit arg0: reflection.universe.RuntimeDIUniverse.Tag[I]): Unit

    Bind by reference to another bound key

    Bind by reference to another bound key

    Example:

    trait T
    class T1 extends T
    
    make[T1]
    make[T].using[T1]

    Here, only T1 will be created. A class that depends on T will receive an instance of T1

    Definition Classes
    BindDSLBase
  43. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  45. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from BindDSLMutBase[T]

Inherited from BindDSLBase[T, Unit]

Inherited from AnyRef

Inherited from Any

Ungrouped