removeFields

Description

With this configuration toggle you can remove all fields from the generated diagram text.

If you want to remove specific fields from the diagram, you have to use the field blacklist regular expression configuration option.

If you want to hide all fields on the rendered diagram but do not want to remove them from the diagram text, you have to use the hide fields configuration option.

Default value

The default value of this configuration option is false (nothing is removed).

Example

Here is an example from the JUnit tests using this configuration parameter:

String filename = "class/0016_remove_fields.txt";
classLoader.loadClass("de.elnarion.test.domain.t0016.Testclass1");
classLoader.loadClass("de.elnarion.test.domain.t0016.Testclass2");
List<String> scanPackages = new ArrayList<>();
scanPackages.add("de.elnarion.test.domain.t0016");
PlantUMLClassDiagramConfig config = new PlantUMLClassDiagramConfigBuilder(scanPackages).withRemoveFields(true)
        .build(); (1)
PlantUMLClassDiagramGenerator generator = new PlantUMLClassDiagramGenerator(config);
String result = generator.generateDiagramText();
String expectedDiagramText = IOUtils.toString(Objects.requireNonNull(classLoader.getResource(filename)), StandardCharsets.UTF_8);
assertNotNull(result);
assertNotNull(expectedDiagramText);
assertEquals(expectedDiagramText.replaceAll("\\s+", ""), result.replaceAll("\\s+", ""));
1 toggle "remove fields" configuration

which is rendered this way:

0016_remove_fields_diagram

and produces this PlantUML diagram text:

@startuml

class de.elnarion.test.domain.t0016.Testclass1 {
	{method} +doSomething () : void
}

class de.elnarion.test.domain.t0016.Testclass2 {
	{method} #doSomething () : void
}

de.elnarion.test.domain.t0016.Testclass1 -->  de.elnarion.test.domain.t0016.Testclass2 : testfield2

@enduml