Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.inject.rebind.binding
Class Dependency

    java.lang.Object
      com.google.gwt.inject.rebind.binding.Dependency

    public class Dependency

extends java.lang.Object

Representation of a dependency edge. Contains information about the source and target `Key<?>`s, as well as the properties of the edge (optional/requried, lazy/eager).

Dependencies also store the context in which the dependency arose. This is not part of the dependency's identity from the point of view of equals() and hashCode(), which ultimately means that if the same dependency arises in several different contexts, we will pick an arbitrary instance (specifically, the first one encountered, see `DependencyGraph`).

Field Summary
`static Key<?>` | `GINJECTOR` A unique key used to indicate that a dependency originated in the Ginjector; for instance, keys produced by the root Ginjector, or while visiting bindings in `GuiceBindingVisitor` often have as their source `GINJECTOR`.

Constructor Summary
`Dependency(Key<?> source, Key<?> target, boolean optional, boolean lazy, Context context)` Construct a dependency edge from the given source to target keys.
`Dependency(Key<?> source, Key<?> target, boolean optional, boolean lazy, java.lang.String context, java.lang.Object... contextArgs)` Construct a dependency edge from the given source to target keys.
`Dependency(Key<?> source, Key<?> target, Context context)` Construct a dependency edge from the given source to target keys.
`Dependency(Key<?> source, Key<?> target, java.lang.String context, java.lang.Object... contextArgs)` Construct a dependency edge from the given source to target keys.

Method Summary
`boolean` | `equals(java.lang.Object obj)`
`Context` | `getContext()`
`Key<?>` | `getSource()`
`Key<?>` | `getTarget()`
`int` | `hashCode()`
`boolean` | `isLazy()`
`boolean` | `isOptional()`
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### GINJECTOR

    public static final Key<?> GINJECTOR

  A unique key used to indicate that a dependency originated in the Ginjector; for instance, keys produced by the root Ginjector, or while visiting bindings in `GuiceBindingVisitor` often have as their source `GINJECTOR`.

Constructor Detail

### Dependency

    public Dependency(Key<?> source,
                      Key<?> target,
                      java.lang.String context,
                      java.lang.Object... contextArgs)

  Construct a dependency edge from the given source to target keys. Creates a required, eager edge.

  Parameters:
    `source` - The key that depends on target. Can use `GINJECTOR` as described above.
    `target` - the key that is depended on
    `context` - a brief description of the context of the dependency (e.g., Foo.java:123)
    `contextArgs` - arguments to pretty-print into the context as with `PrettyPrinter.format(java.lang.String, java.lang.Object...)`

### Dependency

    public Dependency(Key<?> source,
                      Key<?> target,
                      Context context)

  Construct a dependency edge from the given source to target keys. Creates a required, eager edge.

  Parameters:
    `source` - The key that depends on target. Can use `GINJECTOR` as described above.
    `target` - the key that is depended on
    `context` - the context of the dependency (e.g., Foo.java:123)

### Dependency

    public Dependency(Key<?> source,
                      Key<?> target,
                      boolean optional,
                      boolean lazy,
                      java.lang.String context,
                      java.lang.Object... contextArgs)

  Construct a dependency edge from the given source to target keys.

  Parameters:
    `source` - The key that depends on the target. Can use `GINJECTOR` as described above.
    `target` - the key that is depended on
    `optional` - `true` iff the dependency is optional. Errors will not be reported if the target is unavailable.
    `lazy` - `true` iff the dependency is only needed on-demand (eg, by calling `Provider.get()`). A cycle is only a problem if none of the edges are lazy.
    `context` - a brief description of the context of the dependency (e.g., Foo.java:123)
    `contextArgs` - arguments to pretty-print into the context as with `PrettyPrinter.format(java.lang.String, java.lang.Object...)`

### Dependency

    public Dependency(Key<?> source,
                      Key<?> target,
                      boolean optional,
                      boolean lazy,
                      Context context)

  Construct a dependency edge from the given source to target keys.

  Parameters:
    `source` - The key that depends on the target. Can use `GINJECTOR` as described above.
    `target` - the key that is depended on
    `optional` - `true` iff the dependency is optional. Errors will not be reported if the target is unavailable.
    `lazy` - `true` iff the dependency is only needed on-demand (eg, by calling `Provider.get()`). A cycle is only a problem if none of the edges are lazy.
    `context` - the context of the dependency (e.g., Foo.java:123)

Method Detail

### getContext

    public Context getContext()

### getTarget

    public Key<?> getTarget()

### getSource

    public Key<?> getSource()

### isOptional

    public boolean isOptional()

### isLazy

    public boolean isLazy()

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD