hideFields

Description

With this configuration toggle you can hide all fields in the rendered diagram but they are still part of 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 remove all fields from the diagram completely, you have to use the remove fields configuration option.

Default value

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

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+", ""));
1 activate the hide fields toggle in the configuration

which is rendered this way:

0007_hide_parameters_diagram

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