Package Names on Classes

0 votes
asked Sep 26, 2016 in To be sorted by anonymous
I use the "set namespaceSeparator none" to put the package name in the class name, instead of having a separate package. The name of the class now appears with the package name followed by the class name.

Is it possible to display the package name below the class name on a different line, and in a different font? Preferably, I would like the name of the class to be bolded in a bigger font for clarity, and the package name in an unbolded font in smaller font since it usually is long, and I do not want to force the class sizes to be any wider than they need to be.

Thanks! Loving PlantUML.

1 Answer

0 votes
answered Sep 27, 2016 by plantuml (298,440 points)

Hi,

Do not hesitate to post simple example of what you are expecting, or close to what you are expecting.

Is this something like:

@startuml
set namespaceSeparator none
class "<b>MyClass</b>\n<size:8>com.mydomain.package" as com.mydomain.package.MyClass {
}
@enduml

http://plantuml.com/plantuml/uml/AqujKSXBp4qjBaXCJWrEBKWiIYp9BrB8oyzBvKhEIImkLb2oIRBphNG6iMtqa-nYycoACwjIhIpialDpzN8hK_9p4pFpz83QinFJKvKK4eiLi4deGOrGgEQg1G00

Tell us if it's the case (or if it's not!)

 

commented Sep 27, 2016 by anonymous
Perfect! Thank you.
commented Sep 27, 2016 by plantuml (298,440 points)
This is typically a case where you can use the preprocessor.

Example:
@startuml
set namespaceSeparator none
!define CLASS(name,package) class "<b>name</b>\n<size:8>package" as package.name
CLASS(MyClass1, com.mydomain.package.foo) {
}
@enduml

http://plantuml.com/plantuml/uml/DSmn2y8m40NWFR_Yx6IXHDn4Ga2wwfJLvPfU9MZkIgzB5V-x1klsU7plASt0c4b7Z1Hen0bdcO25oMnw6X8JjETJ2DkYcg-wuurgY0zKXSfrllHkr_ahEqrFEXxyYYf0XJNReepvFLsMjgpt3KJ9DY-zP4ni_tGGgU5btXy0
...