Package com.google.inject.grapher
Class DefaultNodeCreator.NodeVisitor
java.lang.Object
com.google.inject.spi.DefaultBindingTargetVisitor<Object,Collection<Node>>
com.google.inject.grapher.DefaultNodeCreator.NodeVisitor
- All Implemented Interfaces:
BindingTargetVisitor<Object,
Collection<Node>>
- Enclosing class:
- DefaultNodeCreator
private static final class DefaultNodeCreator.NodeVisitor
extends DefaultBindingTargetVisitor<Object,Collection<Node>>
BindingTargetVisitor
that adds nodes to the graph based on the visited Binding
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ImplementationNode
newImplementationNode
(Binding<?> binding, Collection<Member> members) Returns a new implementation node for the given binding.private <T extends Binding<?> & HasDependencies>
InstanceNodenewInstanceNode
(T binding, Object instance) Returns a new instance node for the givenBinding
.private InterfaceNode
newInterfaceNode
(Binding<?> binding) Returns a new interface node for the givenBinding
.visit
(ConstructorBinding<?> binding) Visitor forConstructorBinding
s.visit
(InstanceBinding<?> binding) Visitor forInstanceBinding
.visit
(ProviderInstanceBinding<?> binding) Same asvisit(InstanceBinding)
, but the binding edge isBindingEdgeType#PROVIDER
.visitOther
(Binding<?> binding) Default visit implementation.
-
Constructor Details
-
NodeVisitor
private NodeVisitor()
-
-
Method Details
-
newInterfaceNode
Returns a new interface node for the givenBinding
. -
newImplementationNode
Returns a new implementation node for the given binding.- Parameters:
binding
- binding for the node to createmembers
- members to add to the node- Returns:
- implementation node for the given binding
-
newInstanceNode
private <T extends Binding<?> & HasDependencies> InstanceNode newInstanceNode(T binding, Object instance) Returns a new instance node for the givenBinding
.- Parameters:
binding
- binding for the node to createinstance
- value of the instance- Returns:
- instance node for the given binding
-
visit
Visitor forConstructorBinding
s. These are for classes that Guice will instantiate to satisfy injection requests.- Specified by:
visit
in interfaceBindingTargetVisitor<Object,
Collection<Node>> - Overrides:
visit
in classDefaultBindingTargetVisitor<Object,
Collection<Node>>
-
visit
Visitor forInstanceBinding
. We render two nodes in this case: an interface node for the binding'sKey
, and then an implementation node for the instanceObject
itself.- Specified by:
visit
in interfaceBindingTargetVisitor<Object,
Collection<Node>> - Overrides:
visit
in classDefaultBindingTargetVisitor<Object,
Collection<Node>>
-
visit
Same asvisit(InstanceBinding)
, but the binding edge isBindingEdgeType#PROVIDER
.- Specified by:
visit
in interfaceBindingTargetVisitor<Object,
Collection<Node>> - Overrides:
visit
in classDefaultBindingTargetVisitor<Object,
Collection<Node>>
-
visitOther
Description copied from class:DefaultBindingTargetVisitor
Default visit implementation. Returnsnull
.- Overrides:
visitOther
in classDefaultBindingTargetVisitor<Object,
Collection<Node>>
-