org.elasticsearch.common.inject.spi
Class Dependency<T>

java.lang.Object
  extended by org.elasticsearch.common.inject.spi.Dependency<T>

public final class Dependency<T>
extends Object

A variable that can be resolved by an injector.

Use get(org.elasticsearch.common.inject.Key) to build a freestanding dependency, or InjectionPoint to build one that's attached to a constructor, method or field.

Since:
2.0
Author:
crazybob@google.com (Bob Lee), jessewilson@google.com (Jesse Wilson)

Method Summary
 boolean equals(Object o)
           
static Set<Dependency<?>> forInjectionPoints(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.
 InjectionPoint getInjectionPoint()
          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.
 int getParameterIndex()
          Returns the index of this dependency in the injection point's parameter list, or -1 if this dependency does not belong to a parameter list.
 int hashCode()
           
 boolean isNullable()
          Returns true if null is a legal value for this dependency.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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 Set<Dependency<?>> forInjectionPoints(Set<InjectionPoint> injectionPoints)
Returns the dependencies from the given injection points.


getKey

public Key<T> getKey()
Returns the key to the binding that satisfies this dependency.


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 -1 if 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:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2012. All Rights Reserved.