Sunday 16 July 2023

PlantUML: Hide and show circled character in front of class name

Plant UML, show a circled character in front to class, interface, enum widgets by default. We can hide this behavior using the command ‘hide circle’.

Example1

hide circle : Hide circle for all the entities

Example 2 : Hide circle for selected entities

hide Serializable circle
hide Employee circle
hide Manager circle

Below snippet shows the default behaviour.

 

withCircleChar.txt

@startuml

interface Serializable{}
abstract class AbstractList {}

class Employee{
	int id
	String name
	int age

	String aboutMe()
}

class Manager{
	int noOfReportees
}

Serializable <|.. Employee
Employee <|-- Manager


@enduml

Above snippet generate below diagram.




Let’s hide the circles using below commands.

 

hide Serializable circle

hide Employee circle

hide Manager circle

 

hideCircle.txt

@startuml

interface Serializable{}
abstract class AbstractList {}

class Employee{
	int id
	String name
	int age

	String aboutMe()
}

class Manager{
	int noOfReportees
}

Serializable <|.. Employee
Employee <|-- Manager

hide Serializable circle
hide Employee circle
hide Manager circle

@enduml

Above snippet generate below diagram.



 

Below snippet hide circle for all the entities.

 

hideCircle2.txt

@startuml

interface Serializable{}
abstract class AbstractList {}

class Employee{
	int id
	String name
	int age

	String aboutMe()
}

class Manager{
	int noOfReportees
}

Serializable <|.. Employee
Employee <|-- Manager

hide circle

@enduml

 


 

Similarly, you can use both hide and show combination.

 

Example

hide circle

show Employee circle

 

Above snippet hide circle for all the members, except for the Employee class.

 

showCircle.txt

@startuml

interface Serializable{}
abstract class AbstractList {}

class Employee{
	int id
	String name
	int age

	String aboutMe()
}

class Manager{
	int noOfReportees
}

Serializable <|.. Employee
Employee <|-- Manager

hide circle
show Employee circle

@enduml

Above snippet generate below diagram.



 

  

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment