ComponentPath componentPath = source(entryPoint).componentPath(); if (!componentPath.atRoot() || !requestElement.getEnclosingElement().equals(rootComponent)) {
diagnosticReporter.reportComponent( ERROR, bindingGraph.componentNode(cycle.nodes().asList().get(0).componentPath()).get(), errorMessage(cycle, bindingGraph)); return;
private void reportMissingModuleParameters( ChildFactoryMethodEdge edge, ImmutableSet<TypeElement> missingModules, BindingGraph graph, DiagnosticReporter diagnosticReporter) { diagnosticReporter.reportSubcomponentFactoryMethod( ERROR, edge, "%s requires modules which have no visible default constructors. " + "Add the following modules as parameters to this method: %s", graph .network() .incidentNodes(edge) .target() .componentPath() .currentComponent() .getQualifiedName(), Joiner.on(", ").join(missingModules)); } }
TypeElement componentContainingEntryPoint(DependencyEdge entryPoint) { return source(entryPoint).componentPath().currentComponent(); }
private ComponentNode rootComponentNode(Network<Node, Edge> network) { return (ComponentNode) Iterables.find( network.nodes(), node -> node instanceof ComponentNode && node.componentPath().atRoot()); }
private ImmutableList<Node> shortestPathToCycleFromAnEntryPoint( Cycle<Node> cycle, BindingGraph bindingGraph) { Node someCycleNode = cycle.nodes().asList().get(0); ComponentNode componentContainingCycle = bindingGraph.componentNode(someCycleNode.componentPath()).get(); ImmutableList<Node> pathToCycle = shortestPath(bindingGraph.network(), componentContainingCycle, someCycleNode); return subpathToCycle(pathToCycle, cycle); }
/** * Returns a comparator that sorts entry points in components whose paths from the root are * shorter first. */ Comparator<DependencyEdge> rootComponentFirst() { return comparingInt(entryPoint -> source(entryPoint).componentPath().components().size()); }
private ResolvedBindings resolvedDependencies( Node source, DependencyRequest dependencyRequest) { return componentTreePath() .pathFromRootToAncestor(source.componentPath().currentComponent()) .currentGraph() .resolvedBindings(bindingRequest(dependencyRequest)); }
private void appendComponentPathUnlessAtRoot(StringBuilder message, Node node) { if (!node.componentPath().equals(graph.rootComponentNode().componentPath())) { new Formatter(message).format(" [%s]", node.componentPath()); } }