/** * Generate a .dot file which can be fed into GraphViz for layout and visualization of the class graph. * * <p> * Methods, fields and annotations are shown if enabled, via {@link ClassGraph#enableMethodInfo()}, * {@link ClassGraph#enableFieldInfo()} and {@link ClassGraph#enableAnnotationInfo()}. * * <p> * Only public classes, methods, and fields are shown, unless {@link ClassGraph#ignoreClassVisibility()}, * {@link ClassGraph#ignoreMethodVisibility()}, and/or {@link ClassGraph#ignoreFieldVisibility()} has/have been * called. * * @throws IllegalArgumentException * if this {@link ClassInfoList} is empty or {@link ClassGraph#enableClassInfo()} was not called * before scanning (since there would be nothing to graph). * @return the GraphViz file contents. */ public String generateGraphVizDotFile() { return generateGraphVizDotFile(/* sizeX = */ 10.5f, /* sizeY = */ 8.0f, /* showFields = */ true, /* showFieldTypeDependencyEdges = */ true, /* showMethods = */ true, /* showMethodTypeDependencyEdges = */ true, /* showAnnotations = */ true); }
ioWrapper( () -> class_list.generateGraphVizDotFile( dot_file ) );
/** * Generate a .dot file which can be fed into GraphViz for layout and visualization of the class graph. * * <p> * Methods, fields and annotations are shown if enabled, via {@link ClassGraph#enableMethodInfo()}, * {@link ClassGraph#enableFieldInfo()} and {@link ClassGraph#enableAnnotationInfo()}. * * <p> * Only public classes, methods, and fields are shown, unless {@link ClassGraph#ignoreClassVisibility()}, * {@link ClassGraph#ignoreMethodVisibility()}, and/or {@link ClassGraph#ignoreFieldVisibility()} has/have been * called. * * @param sizeX * The GraphViz layout width in inches. * @param sizeY * The GraphViz layout width in inches. * @throws IllegalArgumentException * if this {@link ClassInfoList} is empty or {@link ClassGraph#enableClassInfo()} was not called * before scanning (since there would be nothing to graph). * @return the GraphViz file contents. */ public String generateGraphVizDotFile(final float sizeX, final float sizeY) { return generateGraphVizDotFile(sizeX, sizeY, /* showFields = */ true, /* showFieldTypeDependencyEdges = */ true, /* showMethods = */ true, /* showMethodTypeDependencyEdges = */ true, /* showAnnotations = */ true); }
/** * Generate a and save a .dot file, which can be fed into GraphViz for layout and visualization of the class * graph. * * <p> * Methods, fields and annotations are shown if enabled, via {@link ClassGraph#enableMethodInfo()}, * {@link ClassGraph#enableFieldInfo()} and {@link ClassGraph#enableAnnotationInfo()}. * * <p> * Only public classes, methods, and fields are shown, unless {@link ClassGraph#ignoreClassVisibility()}, * {@link ClassGraph#ignoreMethodVisibility()}, and/or {@link ClassGraph#ignoreFieldVisibility()} has/have been * called. * * @param file * the file to save the GraphViz .dot file to. * @throws IllegalArgumentException * if this {@link ClassInfoList} is empty or {@link ClassGraph#enableClassInfo()} was not called * before scanning (since there would be nothing to graph). * @throws IOException * if the file could not be saved. */ public void generateGraphVizDotFile(final File file) throws IOException { try (final PrintWriter writer = new PrintWriter(file)) { writer.print(generateGraphVizDotFile()); } }