Sunday, 9 July 2023

PlantUML: Define an enum in a class diagram

‘enum’ keyword defines an enum.

 

Example

enum TimeUnit {
	DAYS
	HOURS
	MINUTES
}

 

enum.txt

@startuml

interface List{
	+ int size()
	+ void clear()
}

abstract class AbstractList{
	# int modCount	
}
class ArrayList
class LinkedList
class Serializable

enum TimeUnit {
	DAYS
	HOURS
	MINUTES
}

List <|.. AbstractList 
AbstractList <|-- ArrayList
AbstractList <|-- LinkedList
Serializable <|.. ArrayList
Serializable <|.. LinkedList

@enduml

 

Above snippet generate below diagram.


  

Previous                                                    Next                                                    Home

No comments:

Post a Comment