|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.inject.rebind.binding.Dependency
public class Dependency
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 |
---|
public static final Key<?> GINJECTOR
GuiceBindingVisitor
often have as their source GINJECTOR
.
Constructor Detail |
---|
public Dependency(Key<?> source, Key<?> target, java.lang.String context, java.lang.Object... contextArgs)
source
- The key that depends on target. Can use GINJECTOR
as
described above.target
- the key that is depended oncontext
- 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...)
public Dependency(Key<?> source, Key<?> target, Context context)
source
- The key that depends on target. Can use GINJECTOR
as
described above.target
- the key that is depended oncontext
- the context of the dependency (e.g., Foo.java:123)public Dependency(Key<?> source, Key<?> target, boolean optional, boolean lazy, java.lang.String context, java.lang.Object... contextArgs)
source
- The key that depends on the target. Can use GINJECTOR
as
described above.target
- the key that is depended onoptional
- 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...)
public Dependency(Key<?> source, Key<?> target, boolean optional, boolean lazy, Context context)
source
- The key that depends on the target. Can use GINJECTOR
as
described above.target
- the key that is depended onoptional
- 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 |
---|
public Context getContext()
public Key<?> getTarget()
public Key<?> getSource()
public boolean isOptional()
public boolean isLazy()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |