hideMethods
Description
With this configuration toggle you can hide all methods in the rendered diagram but they are still part of the generated diagram text.
If you want to remove specific methods from the diagram, you have to use the method blacklist regular expression configuration option.
If you want to remove all methods from the diagram completely, you have to use the remove methods configuration option.
Example
Here is an example from the JUnit tests using this configuration parameter:
List<String> scanPackages = new ArrayList<>();
scanPackages.add("de.elnarion.test.domain.t0007");
List<String> hideClasses = new ArrayList<>();
hideClasses.add("de.elnarion.test.domain.t0007.ClassB");
hideClasses.add("de.elnarion.test.domain.t0007.ClassC");
PlantUMLClassDiagramConfigBuilder configBuilder = new PlantUMLClassDiagramConfigBuilder(scanPackages)
.withHideClasses(hideClasses).withHideFieldsParameter(true).withHideMethods(true); (1)
PlantUMLClassDiagramGenerator generator = new PlantUMLClassDiagramGenerator(configBuilder.build());
String result = generator.generateDiagramText();
String expectedDiagramText = IOUtils.toString(Objects.requireNonNull(classLoader.getResource("class/0007_hide_parameters.txt")),
StandardCharsets.UTF_8);
assertNotNull(result);
assertNotNull(expectedDiagramText);
assertEquals(expectedDiagramText.replaceAll("\\s+", ""), result.replaceAll("\\s+", ""));
which is rendered this way:
and produces this PlantUML diagram text:
@startuml
class de.elnarion.test.domain.t0007.ClassA {
{field} +fieldA : String
{field} +fieldB : String
{method} +testMethod () : void
{method} +testMethod2 () : void
}
class de.elnarion.test.domain.t0007.ClassB {
}
class de.elnarion.test.domain.t0007.ClassC {
{field} +fieldA : String
{field} +fieldB : String
{method} +testMethod () : void
{method} +testMethod2 () : void
}
class de.elnarion.test.domain.t0007.ClassD {
}
de.elnarion.test.domain.t0007.ClassB --> de.elnarion.test.domain.t0007.ClassA : testA
de.elnarion.test.domain.t0007.ClassB --> de.elnarion.test.domain.t0007.ClassB : testB
de.elnarion.test.domain.t0007.ClassD --> de.elnarion.test.domain.t0007.ClassC : testC
de.elnarion.test.domain.t0007.ClassD --> de.elnarion.test.domain.t0007.ClassD : testD
hide fields
hide methods
hide de.elnarion.test.domain.t0007.ClassB
hide de.elnarion.test.domain.t0007.ClassC
@enduml