public final class DependencyAndSource
extends java.lang.Object
Dependency
and the source
where the dependency was bound.Modifier and Type | Field and Description |
---|---|
private Dependency<?> |
dependency |
private java.lang.Object |
source |
Constructor and Description |
---|
DependencyAndSource(Dependency<?> dependency,
java.lang.Object source) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getBindingSource()
Returns a string describing where this dependency was bound.
|
Dependency<?> |
getDependency()
Returns the Dependency, if one exists.
|
java.lang.String |
toString() |
private final Dependency<?> dependency
private final java.lang.Object source
public DependencyAndSource(Dependency<?> dependency, java.lang.Object source)
public Dependency<?> getDependency()
Injector.getBinding(com.google.inject.Key<T>)
, a dependency exists. A dependency will not
exist (and this will return null) for types initialized with
Binder.requestInjection(com.google.inject.TypeLiteral<T>, T)
or Injector.injectMembers(Object)
,
nor will it exist for objects injected into Providers bound with
LinkedBindingBuilder#toProvider(Provider).public java.lang.String getBindingSource()
public java.lang.String toString()
toString
in class java.lang.Object