Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait ModuleDeftrait ModuleDefDSLtrait TagsDSLtrait IncludesDSLtrait Moduletrait ModuleBasetrait CachedHashcodeclass Objecttrait Matchableclass AnyShow all
Members list
Type members
Inherited classlikes
Use this to create utility functions that add bindings mutably to the current module, as opposed to creating new modules and including them.
Use this to create utility functions that add bindings mutably to the current module, as opposed to creating new modules and including them.
Example:
import distage.{ClassConstructor, Tag, ModuleDef}
import izumi.distage.model.definition.dsl.ModuleDefDSL
trait RegisteredComponent
class RegisteredComponentImpl extends RegisteredComponent
def addAndRegister[T <: RegisteredComponent: Tag: ClassConstructor](implicit mutateModule: ModuleDefDSL#MutationContext): Unit = {
new mutateModule.dsl {
make[T]
many[RegisteredComponent]
.weak[T]
}
}
new ModuleDef {
addAndRegister[RegisteredComponentImpl]
}
Attributes
- Inherited from:
- AbstractBindingDefDSL
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Inherited methods
Attributes
- Inherited from:
- TagsDSL
Like bindImplicits, but converts even fully resolved implicits into Functoid parameters.
Like bindImplicits, but converts even fully resolved implicits into Functoid parameters.
This may not be what you want, because this will also capture global utility implicits such as DummyImplicit, ClassTag and scala.collection.Factory, and turn them into DI parameters.
Attributes
- Inherited from:
- FunctoidBindImplicitsVersionSpecific
Convert unresolved implicits in the following code block, lambda or a method reference into explicit parameters that will be resolved from the object graph, not the implicit context.
Convert unresolved implicits in the following code block, lambda or a method reference into explicit parameters that will be resolved from the object graph, not the implicit context.
Example:
final case class X(a: Int, b: Double)
// LAMBDA:
make[X].from(bindImplicits {
(i: Int) => X(i, implicitly[Double])
}
// transforms into:
make[X].from {
(i: Int, d: Double) => X(i, d)
}
// CODE BLOCK:
make[X].from(bindImplicits {
X(implicitly[Int], implicitly[Double])
})
// transforms into:
make[X].from {
(i: Int, d: Double) => X(i, d)
}
// METHOD REFERENCE:
def createX(i: Int)(implicit d: Double, dx: DummyImplicit): X = X(i, d)
make[X].from(bindImplicits {
createX
})
// transforms into:
make[X].from {
(i: Int, d: Double) => createX(i)(using d, DummyImplicit.dummyImplicit)
}
// because search for DummyImplicit was __resolved__ in current implicit scope, it was taken from the implicit context,
// not from the object graph!
Attributes
- Note
-
This function is available inside ModuleDef DSL, but it can also be called outside of it as Functoid.bindImplicits
- Inherited from:
- FunctoidBindImplicitsVersionSpecific
Attributes
- Definition Classes
- Inherited from:
- ModuleDefDSL
Compares the receiver object (this) with the argument object (that) for equivalence.
Compares the receiver object (this) with the argument object (that) for equivalence.
Any implementation of this method should be an equivalence relation:
- It is reflexive: for any instance
xof typeAny,x.equals(x)should returntrue. - It is symmetric: for any instances
xandyof typeAny,x.equals(y)should returntrueif and only ify.equals(x)returnstrue. - It is transitive: for any instances
x,y, andzof typeAnyifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue.
If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode to ensure that objects which are "equal" (o1.equals(o2) returns true) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)).
Value parameters
- that
-
the object to compare against this object for equality.
Attributes
- Returns
-
trueif the receiver object is equivalent to the argument;falseotherwise. - Definition Classes
-
ModuleBase -> Any
- Inherited from:
- ModuleBase
Attributes
- Definition Classes
- Inherited from:
- ModuleDefDSL
Attributes
- Inherited from:
- ModuleBase
Attributes
- Definition Classes
- Inherited from:
- ModuleDefDSL
Attributes
- Inherited from:
- AbstractBindingDefDSLMacro
Add tags to all bindings in this module, except for included bindings
Add tags to all bindings in this module, except for included bindings
Attributes
- Inherited from:
- TagsDSL
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
-
ModuleBase -> Any
- Inherited from:
- ModuleBase
Inherited fields
Calculates a hash code value for the object.
Calculates a hash code value for the object.
The default hashing algorithm is platform dependent.
Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.
Attributes
- Returns
-
the hash code value for this object.
- Inherited from:
- CachedHashcode