(BindingGraph bindingGraph)
| 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() { |
nothing calls this directly
no test coverage detected