MCPcopy Index your code
hub / github.com/google/dagger / visitGraph

Method visitGraph

javatests/dagger/spi/FailingPlugin.java:44–87  ·  view source on GitHub ↗
(BindingGraph bindingGraph)

Source from the content-addressed store, hash-verified

42 }
43
44 @Override
45 public ImmutableList<ValidationItem> visitGraph(BindingGraph bindingGraph) {
46 if (options.containsKey("error_on_binding")) {
47 String key = options.get("error_on_binding");
48 return bindingGraph
49 .bindingNodes()
50 .stream()
51 .filter(node -> node.binding().key().toString().equals(key))
52 .map(node -> ValidationItem.create(ERROR, node, "Bad Binding!"))
53 .collect(toImmutableList());
54 }
55
56 if (options.containsKey("error_on_component")) {
57 return ImmutableList.of(
58 ValidationItem.create(ERROR, bindingGraph.rootComponentNode(), "Bad Component!"));
59 }
60
61 if (options.containsKey("error_on_subcomponents")) {
62 return bindingGraph
63 .componentNodes()
64 .stream()
65 .filter(node -> !node.componentPath().atRoot())
66 .map(node -> ValidationItem.create(ERROR, node, "Bad Subcomponent!"))
67 .collect(toImmutableList());
68 }
69
70 if (options.containsKey("error_on_dependency")) {
71 String dependency = options.get("error_on_dependency");
72 return bindingGraph
73 .dependencyEdges()
74 .stream()
75 .filter(
76 edge ->
77 edge.dependencyRequest()
78 .requestElement()
79 .get()
80 .getSimpleName()
81 .contentEquals(dependency))
82 .map(edge -> ValidationItem.create(ERROR, edge, "Bad Dependency!"))
83 .collect(toImmutableList());
84 }
85
86 return ImmutableList.of();
87 }
88
89 @Override
90 public String pluginName() {

Callers

nothing calls this directly

Calls 15

createMethod · 0.95
streamMethod · 0.80
bindingNodesMethod · 0.80
toImmutableListMethod · 0.80
rootComponentNodeMethod · 0.80
componentNodesMethod · 0.80
dependencyEdgesMethod · 0.80
getMethod · 0.65
mapMethod · 0.65
keyMethod · 0.65
componentPathMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected