com.google.inject.spi
Class DependencyAndSource

java.lang.Object
  extended by com.google.inject.spi.DependencyAndSource

public final class DependencyAndSource
extends Object

A combination of a Dependency and the source where the dependency was bound.

Author:
[email protected] (Sam Berlin)

Constructor Summary
DependencyAndSource(Dependency<?> dependency, Object source)
           
 
Method Summary
 String getBindingSource()
          Returns a string describing where this dependency was bound.
 Dependency<?> getDependency()
          Returns the Dependency, if one exists.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DependencyAndSource

public DependencyAndSource(Dependency<?> dependency,
                           Object source)
Method Detail

getDependency

public Dependency<?> getDependency()
Returns the Dependency, if one exists. For anything that can be referenced by Injector.getBinding(com.google.inject.Key), a dependency exists. A dependency will not exist (and this will return null) for types initialized with Binder.requestInjection(com.google.inject.TypeLiteral, T) or Injector.injectMembers(Object), nor will it exist for objects injected into Providers bound with LinkedBindingBuilder#toProvider(Provider).


getBindingSource

public 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 String toString()
Overrides:
toString in class Object


Copyright © 2006-2014 Google, Inc.. All Rights Reserved.