useShortClassNamesInFieldsAndMethods
Description
With this configuration toggle you can specify that all class names in internal fields or method parameters or method return types in the diagram should be generated without any package name.
If you want to shorten the class names at all, you have to use the useShortClassNames configuration option.
This feature is only available with version 2.0.0 or higher. |
Example
In the following example there are three dependencies in the maven dependency hierarchy which build the classpath for all further generation:
<dependencies>
<dependency>
<groupId>de.elnarion.util</groupId>
<artifactId>plantuml-generator-util</artifactId>
<version>@project.version@</version>
<classifier>tests</classifier>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
From this classpath all classes of the package "de.elnarion.test.domain.t0025", which are also used by the JUnit-tests of the PlantUML generator utility, should be generated as class diagram with the following plugin configuration:
<plugin>
<artifactId>plantuml-generator-maven-plugin</artifactId>
<groupId>de.elnarion.maven</groupId>
<version>@project.version@</version>
<executions>
<execution>
<id>generate-simple-diagram</id>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-test-sources</phase>
<configuration>
<outputFilename>testdiagram1.txt</outputFilename>
<scanPackages>
<scanPackage>de.elnarion.test.domain.t0025</scanPackage>
</scanPackages>
<useShortClassNamesInFieldsAndMethods>true</useShortClassNamesInFieldsAndMethods>
</configuration>
</execution>
</executions>
</plugin>
but class names in fields and methods (parameters or return values) should be shortened (no package name). This configuration leads to this diagram:
and produces this PlantUML diagram text:
@startuml
annotation de.elnarion.test.domain.t0025.AnnotationA
interface de.elnarion.test.domain.t0025.InterfaceC {
}
abstract class de.elnarion.test.domain.t0025.SuperClassC {
}
class de.elnarion.test.domain.t0025.TestClassA {
}
class de.elnarion.test.domain.t0025.TestClassB {
{field} -internalField : ClassA
}
class de.elnarion.test.domain.t0025.TestClassC {
{method} +getTestClassA ( paramTestClassB1 : TestClassB ) : TestClassA
}
de.elnarion.test.domain.t0025.SuperClassC --> de.elnarion.test.domain.t0025.InterfaceC : interfaceC
de.elnarion.test.domain.t0025.TestClassA -- de.elnarion.test.domain.t0025.AnnotationA
de.elnarion.test.domain.t0025.TestClassB "1" o-- "0..*" de.elnarion.test.domain.t0025.TestClassA : listTestClassA
de.elnarion.test.domain.t0025.TestClassC --> de.elnarion.test.domain.t0025.TestClassB : fieldTestClassB
de.elnarion.test.domain.t0025.TestClassC --|> de.elnarion.test.domain.t0025.SuperClassC
de.elnarion.test.domain.t0025.TestClassC ..|> de.elnarion.test.domain.t0025.InterfaceC
@enduml