java.lang.Object | |
↳ | com.google.inject.grapher.GraphingVisitor<K, N extends com.google.inject.grapher.InterfaceNode<K>, M extends com.google.inject.grapher.ImplementationNode<K>, B extends com.google.inject.grapher.BindingEdge<K>, D extends com.google.inject.grapher.DependencyEdge<K>> |
BindingTargetVisitor
that adds nodes and edges to the graph based on
the visited Binding
.
This class is parameterized over the four graph element types
(InterfaceNode
, ImplementationNode
, BindingEdge
, and
DependencyEdge
) so that you can extend those interfaces and also
extend this class, and the helper methods will all return your new types.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Visitor for
ConstructorBinding s. | |||||||||||
Visitor for
ConvertedConstantBinding . | |||||||||||
Currently not displayed on the graph.
| |||||||||||
Visitor for
InstanceBinding . | |||||||||||
Visitor for
LinkedKeyBinding . | |||||||||||
Visitor for
ProviderBinding . | |||||||||||
Currently not displayed on the graph.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
BindingEdge from the given node to the specified
node. | |||||||||||
Creates and returns a new
ImplementationNode for the given
Binding , where the Binding is for a class that Guice
will instantiate, rather than a specific instance. | |||||||||||
Creates a new
DependencyEdge from the given node to a
Dependency . | |||||||||||
Adds
DependencyEdge s to the graph for each of the provided
Dependency s. | |||||||||||
Creates and returns a new
ImplementationNode for the given
Binding , where the Binding is for an instance, rather than
a class. | |||||||||||
Creates and returns a new
InterfaceNode object for the given
Binding . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.google.inject.spi.BindingTargetVisitor
|
Visitor for ConstructorBinding
s. These are for classes that Guice
will instantiate to satisfy injection requests. We create a new
ImplementationNode
for the class, then add edges to everything
that it depends on to be instantiated.
Visitor for ConvertedConstantBinding
. The Binding
's
Key
will be of an annotated primitive type, and the value of
getSourceKey()
will be of a
String with the same annotation.
We render this as an InterfaceNode
that has a
BindingEdge
to the source Key
. That will then be rendered
by visit(InstanceBinding)
as an InterfaceNode
with a BindingEdge
to the String instance.
Currently not displayed on the graph.
Visitor for InstanceBinding
. We render two nodes in this case: a
InterfaceNode
for the binding's Key
, and then an
ImplementationNode
for the instance Object itself. We run
a binding node between them.
We then render any DependencyEdge
s that the instance may have,
which come either from InjectionPoint
s (method and field) on the
instance, or on Dependency
s the instance declares through the
HasDependencies
interface.
Visitor for LinkedKeyBinding
. This is the standard Binding
you get from binding an interface class to an implementation class. We
create an InterfaceNode
, then draw a BindingEdge
to the
node of the implementing class.
Visitor for ProviderBinding
. These Binding
s arise from an
InjectionPoint
for the Provider
interface. Since this
isn't tremendously interesting information, we don't render this binding
on the graph, and instead let the DependencyEdge
go straight from
the InjectionPoint
to the node specified by
getProvidedKey()
.
Currently not displayed on the graph.
Creates a new BindingEdge
from the given node to the specified
node.
nodeId | ID of the InterfaceNode that binds to the other. |
---|---|
toId | The node ID of a class or instance that is bound. |
type | The BindingEdge.Type of this binding. |
BindingEdge
.
Creates and returns a new ImplementationNode
for the given
Binding
, where the Binding
is for a class that Guice
will instantiate, rather than a specific instance.
Creates a new DependencyEdge
from the given node to a
Dependency
.
This method takes more comprehensive parameters than strictly necessary in case they would be useful to overriding implementations.
nodeId | ID of the ImplementationNode where the edges will start. |
---|---|
injectionPoint | The InjectionPoint that gave rise to this
Dependency , if one exists. Used to figure out which
Member the edge should point from. |
dependency | The Dependency to represent with this edge. |
DependencyEdge
.
Adds DependencyEdge
s to the graph for each of the provided
Dependency
s. These will be from the given node ID to the
Dependency
's Key
.
If a Dependency
has an associated InjectionPoint
, its
member will be added to the given ImplementationNode
and the edge
will start at the Member.
nodeId | ID of the node that should be the tail of the
DependencyEdge s. |
---|---|
node | An ImplementationNode to add Members to. |
dependencies | Collection of Dependency s from the
Binding . |
DependencyEdge
s that were
added to the graph.
Creates and returns a new ImplementationNode
for the given
Binding
, where the Binding
is for an instance, rather than
a class.
Creates and returns a new InterfaceNode
object for the given
Binding
.