Search in sources :

Example 1 with GraphvizGrapher

use of com.google.inject.grapher.graphviz.GraphvizGrapher in project runelite by runelite.

the class PluginManagerTest method dumpGraph.

@Test
public void dumpGraph() throws Exception {
    List<Module> modules = new ArrayList<>();
    modules.add(new GraphvizModule());
    modules.add(new RuneLiteModule());
    runelite.setClient(client);
    PluginManager pluginManager = new PluginManager();
    pluginManager.loadCorePlugins();
    for (Plugin p : pluginManager.getPlugins()) {
        modules.add(p);
    }
    File file = folder.newFile();
    try (PrintWriter out = new PrintWriter(file, "UTF-8")) {
        Injector injector = Guice.createInjector(modules);
        GraphvizGrapher grapher = injector.getInstance(GraphvizGrapher.class);
        grapher.setOut(out);
        grapher.setRankdir("TB");
        grapher.graph(injector);
    }
}
Also used : Injector(com.google.inject.Injector) ArrayList(java.util.ArrayList) GraphvizModule(com.google.inject.grapher.graphviz.GraphvizModule) Module(com.google.inject.Module) RuneLiteModule(net.runelite.client.RuneLiteModule) BoundFieldModule(com.google.inject.testing.fieldbinder.BoundFieldModule) GraphvizModule(com.google.inject.grapher.graphviz.GraphvizModule) GraphvizGrapher(com.google.inject.grapher.graphviz.GraphvizGrapher) RuneLiteModule(net.runelite.client.RuneLiteModule) File(java.io.File) PrintWriter(java.io.PrintWriter) Test(org.junit.Test)

Example 2 with GraphvizGrapher

use of com.google.inject.grapher.graphviz.GraphvizGrapher in project pinpoint by naver.

the class Grapher method graph.

public void graph(String filename, Injector demoInjector) throws IOException {
    PrintWriter out = new PrintWriter(filename, StandardCharsets.UTF_8.name());
    Injector injector = Guice.createInjector(new GraphvizModule());
    GraphvizGrapher grapher = injector.getInstance(GraphvizGrapher.class);
    grapher.setOut(out);
    grapher.setRankdir("TB");
    grapher.graph(demoInjector);
}
Also used : Injector(com.google.inject.Injector) GraphvizModule(com.google.inject.grapher.graphviz.GraphvizModule) GraphvizGrapher(com.google.inject.grapher.graphviz.GraphvizGrapher) PrintWriter(java.io.PrintWriter)

Example 3 with GraphvizGrapher

use of com.google.inject.grapher.graphviz.GraphvizGrapher in project guice by google.

the class InjectorGrapherDemo method main.

public static void main(String[] args) throws Exception {
    // TODO(user): Switch to Stage.TOOL when issue 297 is fixed.
    Injector demoInjector = Guice.createInjector(Stage.DEVELOPMENT, new BackToTheFutureModule(), new MultibinderModule(), new PrivateTestModule());
    PrintWriter out = new PrintWriter(new File(args[0]), "UTF-8");
    Injector injector = Guice.createInjector(new GraphvizModule());
    GraphvizGrapher grapher = injector.getInstance(GraphvizGrapher.class);
    grapher.setOut(out);
    grapher.setRankdir("TB");
    grapher.graph(demoInjector);
}
Also used : Injector(com.google.inject.Injector) GraphvizModule(com.google.inject.grapher.graphviz.GraphvizModule) GraphvizGrapher(com.google.inject.grapher.graphviz.GraphvizGrapher) File(java.io.File) PrintWriter(java.io.PrintWriter)

Example 4 with GraphvizGrapher

use of com.google.inject.grapher.graphviz.GraphvizGrapher in project roboguice by roboguice.

the class InjectorGrapherDemo method main.

public static void main(String[] args) throws Exception {
    // TODO(phopkins): Switch to Stage.TOOL when issue 297 is fixed.
    Injector demoInjector = Guice.createInjector(Stage.DEVELOPMENT, new BackToTheFutureModule(), new MultibinderModule(), new PrivateTestModule());
    PrintWriter out = new PrintWriter(new File(args[0]), "UTF-8");
    Injector injector = Guice.createInjector(new GraphvizModule());
    GraphvizGrapher grapher = injector.getInstance(GraphvizGrapher.class);
    grapher.setOut(out);
    grapher.setRankdir("TB");
    grapher.graph(demoInjector);
}
Also used : Injector(com.google.inject.Injector) GraphvizModule(com.google.inject.grapher.graphviz.GraphvizModule) GraphvizGrapher(com.google.inject.grapher.graphviz.GraphvizGrapher) File(java.io.File) PrintWriter(java.io.PrintWriter)

Aggregations

Injector (com.google.inject.Injector)4 GraphvizGrapher (com.google.inject.grapher.graphviz.GraphvizGrapher)4 GraphvizModule (com.google.inject.grapher.graphviz.GraphvizModule)4 PrintWriter (java.io.PrintWriter)4 File (java.io.File)3 Module (com.google.inject.Module)1 BoundFieldModule (com.google.inject.testing.fieldbinder.BoundFieldModule)1 ArrayList (java.util.ArrayList)1 RuneLiteModule (net.runelite.client.RuneLiteModule)1 Test (org.junit.Test)1