Package com.google.inject.spi
Class Dependency<T>
- java.lang.Object
-
- com.google.inject.spi.Dependency<T>
-
public final class Dependency<T> extends java.lang.ObjectA variable that can be resolved by an injector.Use
get(com.google.inject.Key<T>)to build a freestanding dependency, orInjectionPointto build one that's attached to a constructor, method or field.- Since:
- 2.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static java.util.Set<Dependency<?>>forInjectionPoints(java.util.Set<InjectionPoint> injectionPoints)Returns the dependencies from the given injection points.static <T> Dependency<T>get(Key<T> key)Returns a new dependency that is not attached to an injection point.InjectionPointgetInjectionPoint()Returns the injection point to which this dependency belongs, or null if this dependency isn't attached to a particular injection point.Key<T>getKey()Returns the key to the binding that satisfies this dependency.intgetParameterIndex()Returns the index of this dependency in the injection point's parameter list, or-1if this dependency does not belong to a parameter list.inthashCode()booleanisNullable()Returns true if null is a legal value for this dependency.java.lang.StringtoString()
-
-
-
Method Detail
-
get
public static <T> Dependency<T> get(Key<T> key)
Returns a new dependency that is not attached to an injection point. The returned dependency is nullable.
-
forInjectionPoints
public static java.util.Set<Dependency<?>> forInjectionPoints(java.util.Set<InjectionPoint> injectionPoints)
Returns the dependencies from the given injection points.
-
isNullable
public boolean isNullable()
Returns true if null is a legal value for this dependency.
-
getInjectionPoint
public InjectionPoint getInjectionPoint()
Returns the injection point to which this dependency belongs, or null if this dependency isn't attached to a particular injection point.
-
getParameterIndex
public int getParameterIndex()
Returns the index of this dependency in the injection point's parameter list, or-1if this dependency does not belong to a parameter list. Only method and constuctor dependencies are elements in a parameter list.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-