Search in sources :

Example 1 with Node

use of dagger.model.BindingGraph.Node in project DaggerCodeParse-2.38.1base by hellogaod.

the class ExternalBindingGraphConverter method fromSpiModel.

private static ImmutableNetwork<Node, Edge> fromSpiModel(Network<dagger.spi.model.BindingGraph.Node, dagger.spi.model.BindingGraph.Edge> spiNetwork) {
    MutableNetwork<Node, Edge> network = NetworkBuilder.directed().allowsParallelEdges(true).allowsSelfLoops(true).build();
    ImmutableMap<dagger.spi.model.BindingGraph.Node, Node> fromSpiNodes = spiNetwork.nodes().stream().collect(toImmutableMap(spiNode -> spiNode, ExternalBindingGraphConverter::fromSpiModel));
    for (Node node : fromSpiNodes.values()) {
        network.addNode(node);
    }
    for (dagger.spi.model.BindingGraph.Edge edge : spiNetwork.edges()) {
        EndpointPair<dagger.spi.model.BindingGraph.Node> edgePair = spiNetwork.incidentNodes(edge);
        network.addEdge(fromSpiNodes.get(edgePair.source()), fromSpiNodes.get(edgePair.target()), fromSpiModel(edge));
    }
    return ImmutableNetwork.copyOf(network);
}
Also used : SubcomponentCreatorBindingEdge(dagger.model.BindingGraph.SubcomponentCreatorBindingEdge) DaggerElement(dagger.spi.model.DaggerElement) ComponentNode(dagger.model.BindingGraph.ComponentNode) Scope(dagger.model.Scope) BindingGraph(dagger.model.BindingGraph) EndpointPair(com.google.common.graph.EndpointPair) ComponentPath(dagger.model.ComponentPath) Diagnostic(javax.tools.Diagnostic) DaggerAnnotation(dagger.spi.model.DaggerAnnotation) ImmutableNetwork(com.google.common.graph.ImmutableNetwork) FormatMethod(com.google.errorprone.annotations.FormatMethod) MissingBinding(dagger.model.BindingGraph.MissingBinding) Binding(dagger.model.Binding) DaggerTypeElement(dagger.spi.model.DaggerTypeElement) Network(com.google.common.graph.Network) Key(dagger.model.Key) ImmutableSetMultimap(com.google.common.collect.ImmutableSetMultimap) MaybeBinding(dagger.model.BindingGraph.MaybeBinding) ChildFactoryMethodEdge(dagger.model.BindingGraph.ChildFactoryMethodEdge) DaggerStreams.toImmutableMap(dagger.internal.codegen.extension.DaggerStreams.toImmutableMap) Memoized(com.google.auto.value.extension.memoized.Memoized) ImmutableMap(com.google.common.collect.ImmutableMap) NetworkBuilder(com.google.common.graph.NetworkBuilder) DaggerStreams.toImmutableSet(dagger.internal.codegen.extension.DaggerStreams.toImmutableSet) RequestKind(dagger.model.RequestKind) DaggerStreams.toImmutableList(dagger.internal.codegen.extension.DaggerStreams.toImmutableList) DependencyRequest(dagger.model.DependencyRequest) DependencyEdge(dagger.model.BindingGraph.DependencyEdge) Edge(dagger.model.BindingGraph.Edge) Node(dagger.model.BindingGraph.Node) DiagnosticReporter(dagger.spi.DiagnosticReporter) AutoValue(com.google.auto.value.AutoValue) MutableNetwork(com.google.common.graph.MutableNetwork) Optional(java.util.Optional) MultibindingContributionIdentifier(dagger.model.Key.MultibindingContributionIdentifier) BindingKind(dagger.model.BindingKind) BindingGraph(dagger.model.BindingGraph) ComponentNode(dagger.model.BindingGraph.ComponentNode) Node(dagger.model.BindingGraph.Node) SubcomponentCreatorBindingEdge(dagger.model.BindingGraph.SubcomponentCreatorBindingEdge) ChildFactoryMethodEdge(dagger.model.BindingGraph.ChildFactoryMethodEdge) DependencyEdge(dagger.model.BindingGraph.DependencyEdge) Edge(dagger.model.BindingGraph.Edge)

Aggregations

AutoValue (com.google.auto.value.AutoValue)1 Memoized (com.google.auto.value.extension.memoized.Memoized)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSetMultimap (com.google.common.collect.ImmutableSetMultimap)1 EndpointPair (com.google.common.graph.EndpointPair)1 ImmutableNetwork (com.google.common.graph.ImmutableNetwork)1 MutableNetwork (com.google.common.graph.MutableNetwork)1 Network (com.google.common.graph.Network)1 NetworkBuilder (com.google.common.graph.NetworkBuilder)1 FormatMethod (com.google.errorprone.annotations.FormatMethod)1 DaggerStreams.toImmutableList (dagger.internal.codegen.extension.DaggerStreams.toImmutableList)1 DaggerStreams.toImmutableMap (dagger.internal.codegen.extension.DaggerStreams.toImmutableMap)1 DaggerStreams.toImmutableSet (dagger.internal.codegen.extension.DaggerStreams.toImmutableSet)1 Binding (dagger.model.Binding)1 BindingGraph (dagger.model.BindingGraph)1 ChildFactoryMethodEdge (dagger.model.BindingGraph.ChildFactoryMethodEdge)1 ComponentNode (dagger.model.BindingGraph.ComponentNode)1 DependencyEdge (dagger.model.BindingGraph.DependencyEdge)1 Edge (dagger.model.BindingGraph.Edge)1 MaybeBinding (dagger.model.BindingGraph.MaybeBinding)1