diff --git a/spring-modulith-docs/src/main/java/org/springframework/modulith/docs/Documenter.java b/spring-modulith-docs/src/main/java/org/springframework/modulith/docs/Documenter.java index e8bec7f0..2f91bc7d 100644 --- a/spring-modulith-docs/src/main/java/org/springframework/modulith/docs/Documenter.java +++ b/spring-modulith-docs/src/main/java/org/springframework/modulith/docs/Documenter.java @@ -173,9 +173,8 @@ public class Documenter { * @param options must not be {@literal null}, use {@link Options#defaults()} for default. * @param canvasOptions must not be {@literal null}, use {@link CanvasOptions#defaults()} for default. * @return the current instance, will never be {@literal null}. - * @throws IOException */ - public Documenter writeDocumentation(Options options, CanvasOptions canvasOptions) throws IOException { + public Documenter writeDocumentation(Options options, CanvasOptions canvasOptions) { return writeModulesAsPlantUml(options) .writeIndividualModulesAsPlantUml(options) // @@ -186,9 +185,8 @@ public class Documenter { * Writes the PlantUML component diagram for all {@link ApplicationModules}. * * @param options must not be {@literal null}. - * @throws IOException */ - public Documenter writeModulesAsPlantUml(Options options) throws IOException { + public Documenter writeModulesAsPlantUml(Options options) { Assert.notNull(options, "Options must not be null!"); @@ -196,6 +194,8 @@ public class Documenter { try (Writer writer = new FileWriter(file.toFile())) { writer.write(createPlantUml(options)); + } catch (IOException o_O) { + throw new RuntimeException(o_O); } return this; @@ -228,7 +228,8 @@ public class Documenter { } /** - * Writes the PlantUML component diagram for the given {@link ApplicationModule} with the given rendering {@link Options}. + * Writes the PlantUML component diagram for the given {@link ApplicationModule} with the given rendering + * {@link Options}. * * @param module must not be {@literal null}. * @param options must not be {@literal null}. @@ -310,7 +311,7 @@ public class Documenter { return types.isEmpty() ? "" : writeTableRow(header, mapper.apply(types)); } - public String toPlantUml() throws IOException { + public String toPlantUml() { return createPlantUml(Options.defaults()); } @@ -342,7 +343,8 @@ public class Documenter { Supplier> otherDependencies = () -> options.getDependencyTypes() .flatMap(it -> module.getDependencies(modules, it).stream()); - Supplier> dependencies = () -> Stream.concat(bootstrapDependencies.get(), otherDependencies.get()); + Supplier> dependencies = () -> Stream.concat(bootstrapDependencies.get(), + otherDependencies.get()); addComponentsToView(dependencies, view, options, it -> it.add(getComponents(options).get(module))); } @@ -406,7 +408,8 @@ public class Documenter { .findFirst().ifPresent(view::remove); } - private static Component applyBackgroundColor(ApplicationModule module, Map components, Options options, + private static Component applyBackgroundColor(ApplicationModule module, Map components, + Options options, Styles styles) { Component component = components.get(module); @@ -466,7 +469,7 @@ public class Documenter { } } - private String createPlantUml(Options options) throws IOException { + private String createPlantUml(Options options) { ComponentView componentView = createComponentView(options); componentView.setTitle(modules.getSystemName().orElse("Modules")); @@ -531,7 +534,8 @@ public class Documenter { @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public static class Options { - private static final Set ALL_TYPES = Arrays.stream(DependencyType.values()).collect(Collectors.toSet()); + private static final Set ALL_TYPES = Arrays.stream(DependencyType.values()) + .collect(Collectors.toSet()); private final Set dependencyTypes; @@ -569,8 +573,8 @@ public class Documenter { private final @With Function> colorSelector; /** - * A callback to return a default display names for a given {@link ApplicationModule}. Default implementation just forwards to - * {@link ApplicationModule#getDisplayName()}. + * A callback to return a default display names for a given {@link ApplicationModule}. Default implementation just + * forwards to {@link ApplicationModule#getDisplayName()}. */ private final @With Function defaultDisplayName; @@ -591,8 +595,8 @@ public class Documenter { /** * Creates a new default {@link Options} instance configured to use all dependency types, list immediate - * dependencies for individual module instances, not applying any kind of {@link ApplicationModule} or {@link Component} - * filters and default file names. + * dependencies for individual module instances, not applying any kind of {@link ApplicationModule} or + * {@link Component} filters and default file names. * * @return will never be {@literal null}. */ @@ -730,7 +734,8 @@ public class Documenter { return Optional.ofNullable(targetFileName); } - private static List getMatchingBeans(ApplicationModule module, Grouping filter, List alreadyMapped) { + private static List getMatchingBeans(ApplicationModule module, Grouping filter, + List alreadyMapped) { return module.getSpringBeans().stream() .filter(it -> !alreadyMapped.contains(it))