Package dagger.spi.model
Interface Binding
-
- All Superinterfaces:
BindingGraph.MaybeBinding,BindingGraph.Node
public interface Binding extends BindingGraph.MaybeBinding
The association between aKeyand the way in which instances of the key are provided. Includes any dependencies that are needed in order to provide the instances.If a binding is owned by more than one component, there is one
Bindingfor every owning component.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default java.util.Optional<Binding>binding()Deprecated.This always returnsOptional.of(this).java.util.Optional<DaggerElement>bindingElement()TheDaggerElementthat declares this binding.ComponentPathcomponentPath()The component that owns the binding, or in which the binding is missing.java.util.Optional<DaggerTypeElement>contributingModule()TheDaggerTypeElementof the module which contributes this binding.com.google.common.collect.ImmutableSet<DependencyRequest>dependencies()The dependencies of this binding.booleanisNullable()Returnstrueif this binding may providenullinstead of an instance ofBindingGraph.MaybeBinding.key().booleanisProduction()Returnstrueif this is a production binding, e.g.BindingKindkind()The kind of binding this instance represents.booleanrequiresModuleInstance()Returnstrueif using this binding requires an instance of thecontributingModule().java.util.Optional<Scope>scope()The scope of this binding if it has one.-
Methods inherited from interface dagger.spi.model.BindingGraph.MaybeBinding
key
-
-
-
-
Method Detail
-
componentPath
ComponentPath componentPath()
Description copied from interface:BindingGraph.MaybeBindingThe component that owns the binding, or in which the binding is missing.- Specified by:
componentPathin interfaceBindingGraph.MaybeBinding- Specified by:
componentPathin interfaceBindingGraph.Node
-
binding
@Deprecated default java.util.Optional<Binding> binding()
Deprecated.This always returnsOptional.of(this).Description copied from interface:BindingGraph.MaybeBindingThe binding, or empty if missing.- Specified by:
bindingin interfaceBindingGraph.MaybeBinding
-
dependencies
com.google.common.collect.ImmutableSet<DependencyRequest> dependencies()
The dependencies of this binding. The order of the dependencies corresponds to the order in which they will be injected when the binding is requested.
-
bindingElement
java.util.Optional<DaggerElement> bindingElement()
TheDaggerElementthat declares this binding. Absent for binding kinds that are not always declared by exactly one element.For example, consider
BindingKind.MULTIBOUND_SET. A component with many@IntoSetbindings for the same key will have a synthetic binding that depends on all contributions, but with no identifiying binding element. A@Multibindsmethod will also contribute a synthetic binding, but since multiple@Multibindsmethods can coexist in the same component (and contribute to one single binding), it has no binding element.
-
contributingModule
java.util.Optional<DaggerTypeElement> contributingModule()
TheDaggerTypeElementof the module which contributes this binding. Absent for bindings that have nobinding element.
-
requiresModuleInstance
boolean requiresModuleInstance()
Returnstrueif using this binding requires an instance of thecontributingModule().
-
scope
java.util.Optional<Scope> scope()
The scope of this binding if it has one.
-
isNullable
boolean isNullable()
Returnstrueif this binding may providenullinstead of an instance ofBindingGraph.MaybeBinding.key(). Nullable bindings cannot be requested from non-nullable dependency requests.
-
isProduction
boolean isProduction()
Returnstrueif this is a production binding, e.g. an@Producesmethod.
-
kind
BindingKind kind()
The kind of binding this instance represents.
-
-