Package com.google.inject.spi
Class DependencyAndSource
- java.lang.Object
-
- com.google.inject.spi.DependencyAndSource
-
public final class DependencyAndSource extends java.lang.Object
A combination of aDependency
and thesource
where the dependency was bound.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description DependencyAndSource(Dependency<?> dependency, java.lang.Object source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Constructor Detail
-
DependencyAndSource
public DependencyAndSource(Dependency<?> dependency, java.lang.Object source)
-
-
Method Detail
-
getDependency
public Dependency<?> getDependency()
Returns the Dependency, if one exists. For anything that can be referenced byInjector.getBinding(com.google.inject.Key<T>)
, a dependency exists. A dependency will not exist (and this will return null) for types initialized withBinder.requestInjection(com.google.inject.TypeLiteral<T>, T)
orInjector.injectMembers(Object)
, nor will it exist for objects injected into Providers bound with LinkedBindingBuilder#toProvider(Provider).
-
getBindingSource
public java.lang.String getBindingSource()
Returns a string describing where this dependency was bound. If the binding was just-in-time, there is no valid binding source, so this describes the class in question.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-