showReturnTypes

Description

With the help of this configuration parameter it is possible to show the type of the returned objects of a method call.

The shown types are displayed according to the use short class names toggle which is activated by default.

Default value

The default value of this configuration parameter is false (no return type shown).

Example

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

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

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

// ASSERT
assertAll(() -> assertNotNull(generatedDiagram), () -> assertEquals(expectedDiagramText.replaceAll("\\s+", ""),
		generatedDiagram.replaceAll("\\s+", "")));
1 ignore/remove method calls to "getData"

which is rendered this way:

0001_basic_caller_test_with_return_types_diagram

and produces this PlantUML diagram text:

@startuml

participant CallerA
participant CallerB

activate CallerA
	CallerA -> CallerB : callSomething
	activate CallerB
		CallerB -> CallerB : privateMethodCall
		activate CallerB
			CallerB --> CallerB : void
		deactivate CallerB
		CallerB -> CallerB : protectedMethodCall
		activate CallerB
			CallerB --> CallerB : void
		deactivate CallerB
		CallerB --> CallerA : void
	deactivate CallerB
	CallerA -> CallerB : callSomethingElse
	activate CallerB
		CallerB --> CallerA : String
	deactivate CallerB
deactivate CallerA

@enduml

Without the parameter the diagram would look like this:

0001_basic_caller_test_diagram

If used with an activated use short class names toggle it looks like this:

0001_basic_caller_test_with_return_types_and_long_class_names_diagram