useShortClassNames

Description

With the help of this configuration toggle it is possible to show only the class names in the diagram without the package name (full qualified). Because full qualified names increase the size of the diagram enormously the toggle is activated by default.

The parameter itself targets all class names in the diagram, even the return types of the method calls which can be shown by the show return types parameter.

Default value

The default value of this configuration parameter is true.

Example

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

// ARRANGE
PlantUMLSequenceDiagramConfigBuilder builder = new PlantUMLSequenceDiagramConfigBuilder(CallerA.class.getName(),
		"callSomething").withUseShortClassName(false); (1)
PlantUMLSequenceDiagramGenerator generator = new PlantUMLSequenceDiagramGenerator(builder.build());
String expectedDiagramText = IOUtils.toString(
		Objects.requireNonNull(classLoader.getResource("sequence/0001_basic_caller_with_long_class_names.txt")),
		StandardCharsets.UTF_8);

// ACT
String generatedDiagram = generator.generateDiagramText();

// ASSERT
assertAll(() -> assertNotNull(generatedDiagram), () -> assertEquals(expectedDiagramText.replaceAll("\\s+", ""),
		generatedDiagram.replaceAll("\\s+", "")));
1 deactivate the "use short class names" toggle

which is rendered this way:

0001_basic_caller_with_long_class_names_diagram

and produces this PlantUML diagram text:

@startuml

participant de.elnarion.test.sequence.t0001.CallerA
participant de.elnarion.test.sequence.t0001.CallerB

activate de.elnarion.test.sequence.t0001.CallerA
	de.elnarion.test.sequence.t0001.CallerA -> de.elnarion.test.sequence.t0001.CallerB : callSomething
	activate de.elnarion.test.sequence.t0001.CallerB
		de.elnarion.test.sequence.t0001.CallerB -> de.elnarion.test.sequence.t0001.CallerB : privateMethodCall
		activate de.elnarion.test.sequence.t0001.CallerB
			de.elnarion.test.sequence.t0001.CallerB --> de.elnarion.test.sequence.t0001.CallerB
		deactivate de.elnarion.test.sequence.t0001.CallerB
		de.elnarion.test.sequence.t0001.CallerB -> de.elnarion.test.sequence.t0001.CallerB : protectedMethodCall
		activate de.elnarion.test.sequence.t0001.CallerB
			de.elnarion.test.sequence.t0001.CallerB --> de.elnarion.test.sequence.t0001.CallerB
		deactivate de.elnarion.test.sequence.t0001.CallerB
		de.elnarion.test.sequence.t0001.CallerB --> de.elnarion.test.sequence.t0001.CallerA
	deactivate de.elnarion.test.sequence.t0001.CallerB
	de.elnarion.test.sequence.t0001.CallerA -> de.elnarion.test.sequence.t0001.CallerB : callSomethingElse
	activate de.elnarion.test.sequence.t0001.CallerB
		de.elnarion.test.sequence.t0001.CallerB --> de.elnarion.test.sequence.t0001.CallerA
	deactivate de.elnarion.test.sequence.t0001.CallerB
deactivate de.elnarion.test.sequence.t0001.CallerA

@enduml

Without the parameter the diagram would look like this:

0001_basic_caller_test_diagram

If used with an activated show return types toggle it looks like this:

0001_basic_caller_test_with_return_types_and_long_class_names_diagram