public interface Binding
Key
and the way in which instances of the key are provided.
Includes any dependencies that are needed in order to provide the
instances.Modifier and Type | Method and Description |
---|---|
java.util.Optional<? extends javax.lang.model.element.Element> |
bindingElement()
The
Element that declares this binding. |
java.util.Optional<javax.lang.model.element.TypeElement> |
contributingModule()
The
TypeElement of the module which contributes this binding. |
com.google.common.collect.ImmutableSet<DependencyRequest> |
dependencies()
The dependencies of this binding.
|
boolean |
isNullable()
|
boolean |
isProduction()
Returns
true if this is a production binding, e.g. |
Key |
key()
The binding's key.
|
BindingKind |
kind()
The kind of binding this instance represents.
|
java.util.Optional<Scope> |
scope()
The scope of this binding if it has one.
|
Key key()
com.google.common.collect.ImmutableSet<DependencyRequest> dependencies()
java.util.Optional<? extends javax.lang.model.element.Element> bindingElement()
Element
that 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
@IntoSet
bindings for the same key will have a synthetic binding that depends on all
contributions, but with no identifiying binding element. A @Multibinds
method will also
contribute a synthetic binding, but since multiple @Multibinds
methods can coexist in
the same component (and contribute to one single binding), it has no binding element.
java.util.Optional<javax.lang.model.element.TypeElement> contributingModule()
TypeElement
of the module which contributes this binding. Absent for bindings that
have no binding element
.java.util.Optional<Scope> scope()
boolean isNullable()
true
if this binding may provide null
instead of an instance of key()
. Nullable bindings cannot be requested from non-nullable dependency requests.boolean isProduction()
true
if this is a production binding, e.g. an @Produces
method.BindingKind kind()