public static class ComponentTreeTraverser.BindingGraphTraverser extends Object
| Constructor and Description |
|---|
BindingGraphTraverser(ComponentTreeTraverser.ComponentTreePath componentPath,
dagger.internal.codegen.DependencyRequest entryPoint)
Constructs a traverser for an entry point.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
atDependencyCycle()
Returns
true if the current dependency request is
also higher in the dependency path. |
protected boolean |
atEntryPoint()
Returns
true if the current dependency request is
an entry point. |
protected ComponentTreeTraverser.ComponentTreePath |
componentTreePath()
Returns the path from the root component to the component that includes the entryPointElement() entry point.
|
protected dagger.internal.codegen.BindingGraph |
currentGraph()
Returns the binding graph for the component that is currently being visited.
|
protected ComponentTreeTraverser.DependencyTrace |
cycleDependencyTrace()
Returns the dependency requests and resolved bindings in the dependency cycle, starting with the request closest to the entry point and ending with the
current dependency request.
|
protected dagger.internal.codegen.DependencyRequest |
dependencyRequest()
Returns the dependency request currently being visited.
|
protected ComponentTreeTraverser.DependencyTrace |
dependencyTrace()
Returns the dependency requests and resolved bindings starting with the entry point and
ending with the current dependency request.
|
protected ImmutableSet<? extends dagger.internal.codegen.Binding> |
dependentBindings()
Returns the bindings that depend directly on the current
dependency request.
|
protected Element |
entryPointElement()
Returns the entry point whose dependencies are currently being traversed.
|
dagger.internal.codegen.BindingGraph |
owningGraph(Iterable<dagger.internal.codegen.ContributionBinding> bindings)
Returns the rootmost of the binding graphs in the component path that own each binding.
|
protected dagger.internal.codegen.ResolvedBindings |
resolvedBindings()
Returns the resolved bindings for the current dependency
request.
|
void |
traverseDependencies()
Calls
visitDependencyRequest(DependencyRequest) for the entry point. |
protected void |
visitBinding(dagger.internal.codegen.Binding binding,
dagger.internal.codegen.ComponentDescriptor owningComponent)
Called once for each binding that is reachable from an entry point.
|
protected void |
visitContributionBinding(dagger.internal.codegen.ContributionBinding binding,
dagger.internal.codegen.ComponentDescriptor owningComponent)
Called once for each contribution binding that is reachable from an entry point.
|
protected void |
visitContributionBindings(dagger.internal.codegen.ResolvedBindings resolvedBindings)
Called once for each dependency request for a contribution that is reachable from an entry
point.
|
protected void |
visitDependencyRequest(dagger.internal.codegen.DependencyRequest dependencyRequest)
Called once for each dependency request that is reachable from an entry point.
|
protected void |
visitMembersInjectionBinding(dagger.internal.codegen.MembersInjectionBinding binding,
dagger.internal.codegen.ComponentDescriptor owningComponent)
Called once for each members injection binding that is reachable from an entry point.
|
protected void |
visitMembersInjectionBindings(dagger.internal.codegen.ResolvedBindings resolvedBindings)
Called once for each dependency request for a members injector that is reachable from an
entry point.
|
protected void |
visitResolvedBindings(dagger.internal.codegen.ResolvedBindings resolvedBindings)
Called once for each dependency request that is reachable from an entry point.
|
public BindingGraphTraverser(ComponentTreeTraverser.ComponentTreePath componentPath, dagger.internal.codegen.DependencyRequest entryPoint)
componentPath - the path from the root component to the component that includes the
entry point to be traversedentryPoint - the entry point to be traversedpublic void traverseDependencies()
visitDependencyRequest(DependencyRequest) for the entry point.IllegalStateException - if a traversal is in progressprotected void visitDependencyRequest(dagger.internal.codegen.DependencyRequest dependencyRequest)
Subclasses can override this method to perform whatever logic is required per dependency
request. They should call the super implementation if they want to continue the
traversal in the standard order.
This implementation calls visitResolvedBindings(ResolvedBindings) unless the
dependency request introduces a cycle.
dependencyRequest - the object returned by dependencyRequest()protected void visitResolvedBindings(dagger.internal.codegen.ResolvedBindings resolvedBindings)
Subclasses can override this method to perform whatever logic is required per resolved
bindings. They should call the super implementation if they want to continue the
traversal in the standard order.
This implementation calls either visitMembersInjectionBindings(ResolvedBindings)
or visitContributionBindings(ResolvedBindings), depending on the binding key kind.
resolvedBindings - the object returned by resolvedBindings()protected void visitMembersInjectionBindings(dagger.internal.codegen.ResolvedBindings resolvedBindings)
Subclasses can override this method to perform whatever logic is required per resolved
members injection bindings. They should call the super implementation if they want to
continue the traversal in the standard order.
This implementation calls visitMembersInjectionBinding(MembersInjectionBinding,
ComponentDescriptor).
resolvedBindings - the object returned by resolvedBindings()protected void visitMembersInjectionBinding(dagger.internal.codegen.MembersInjectionBinding binding,
dagger.internal.codegen.ComponentDescriptor owningComponent)
Subclasses can override this method to perform whatever logic is required per members
injection binding. They should call the super implementation if they want to continue
the traversal in the standard order.
This implementation calls visitBinding(Binding, ComponentDescriptor).
binding - the only value of resolvedBindings().allMembersInjectionBindings()owningComponent - the only key of resolvedBindings().allMembersInjectionBindings(). The binding's dependencies should be
resolved within this component.protected void visitContributionBindings(dagger.internal.codegen.ResolvedBindings resolvedBindings)
Subclasses can override this method to perform whatever logic is required per resolved
contribution bindings. They should call the super implementation if they want to
continue the traversal in the standard order.
This implementation calls visitContributionBinding(ContributionBinding,
ComponentDescriptor) for each contribution binding.
resolvedBindings - the object returned by resolvedBindings()protected void visitContributionBinding(dagger.internal.codegen.ContributionBinding binding,
dagger.internal.codegen.ComponentDescriptor owningComponent)
Subclasses can override this method to perform whatever logic is required per contribution
binding. They should call the super implementation if they want to continue the
traversal in the standard order.
This implementation calls visitBinding(Binding, ComponentDescriptor).
binding - a value of resolvedBindings().allContributionBindings()owningComponent - the key of resolvedBindings().allContributionBindings() for
binding. The binding's dependencies should be resolved within this component.protected void visitBinding(dagger.internal.codegen.Binding binding,
dagger.internal.codegen.ComponentDescriptor owningComponent)
Subclasses can override this method to perform whatever logic is required per binding.
They should call the super implementation if they want to continue the traversal in
the standard order.
This implementation calls visitDependencyRequest(DependencyRequest) for each
dependency of the binding, resolved within owningComponent, that has not already been
visited while traversing the current entry point.
binding - a value of resolvedBindings().allBindings()owningComponent - the key of resolvedBindings().allBindings() for binding. The binding's dependencies should be resolved within this component.protected final ComponentTreeTraverser.ComponentTreePath componentTreePath()
public dagger.internal.codegen.BindingGraph owningGraph(Iterable<dagger.internal.codegen.ContributionBinding> bindings)
For arguments [x, y], if binding x is owned by component A and
binding y is owned by component B, and A is an ancestor of B,
then this method returns the binding graph for A.
protected final boolean atDependencyCycle()
true if the current dependency request is
also higher in the dependency path.IllegalStateException - if this object is not currently traversing dependenciesprotected final dagger.internal.codegen.DependencyRequest dependencyRequest()
IllegalStateException - if this object is not currently traversing dependenciesprotected final dagger.internal.codegen.ResolvedBindings resolvedBindings()
IllegalStateException - if this object is not currently traversing dependenciesprotected final ImmutableSet<? extends dagger.internal.codegen.Binding> dependentBindings()
protected final Element entryPointElement()
IllegalStateException - if this object is not currently traversing dependenciesprotected final boolean atEntryPoint()
true if the current dependency request is
an entry point.protected final dagger.internal.codegen.BindingGraph currentGraph()
protected final ComponentTreeTraverser.DependencyTrace dependencyTrace()
protected final ComponentTreeTraverser.DependencyTrace cycleDependencyTrace()
The first request and the last request in the trace will have the same binding key.
Copyright © 2012–2017 The Dagger Authors. All rights reserved.