Monday 31 July 2023

PlantUML: Customize the spot in classes, interfaces and enums

PlantUML use following spotted characters by default in the class diagram.

 

a.   C : to represent the class

b.   I : to represent an interface

c.    E : to represent an enum

d.   A : to represent an abstract class

 

defaultSpotDemo.txt

@startuml

	interface MyInterface1
	class MyClass1
	abstract class MyAbstractClass1
	enum MyEnum1
	
@enduml

Above snippet generate below diagram.



 

How to define custom spot?

Using the stereotype notation, we can add a  custom character and a color.

 

Example

interface MyInterface1<< (S, #FF7700) stereoType1>>
class MyClass1 << (T, red) >>

customSpot.txt

@startuml

	interface MyInterface1<< (S, #FF7700) stereoType1>>
	class MyClass1 << (T, red) >>
	abstract class MyAbstractClass1 << (U, green) >>
	enum MyEnum1 << (V, aqua) >>
	
@enduml

Above snippet generate below diagram.



 

Previous                                                    Next                                                    Home

No comments:

Post a Comment