Skip to main content

PlantUML Class Diagrams

This page tests the English A11y descriptions for class diagrams.

Simple class diagram with 1 class

WordList class

PlantUML source for "WordList class"
@startuml
class WordList {
-words : String[]
+sort() : void
}
@enduml

Class diagram with 1 class(es) and 0 relation(s).

Classes:

  • Class WordList with:
    • public method 'sort', without parameters, return type void
    • private attribute 'words' of type String Array

Class diagram with 3 classes and relationships

Strategy Pattern

PlantUML source for "Strategy Pattern"
@startuml
interface SortStrategy {
+sort(words: String[]) : void
}

class WordList {
-words : String[]
+sort() : void
}

class MergeSort {
+sort(words: String[]) : void
}

WordList --> SortStrategy : currentStrategy
MergeSort ..|> SortStrategy
@enduml

Class diagram with 3 class(es) and 2 relation(s).

Classes:

  • Interface SortStrategy with:
    • public method 'sort', with parameter(s) 'words' of type String[], return type void
    • no attributes
  • Class WordList with:
    • public method 'sort', without parameters, return type void
    • private attribute 'words' of type String Array
  • Class MergeSort with:
    • public method 'sort', with parameter(s) 'words' of type String[], return type void
    • no attributes

Relations:

  • WordList has an association-relationship named 'currentStrategy' with SortStrategy
  • MergeSort implements interface SortStrategy

Extended class diagram with 5 classes and 4 relationships

Extended Strategy Pattern

PlantUML source for "Extended Strategy Pattern"
@startuml
class WordList {
-words : String[]
+sort() : void
+setSortStrategy(strategy : SortStrategy) : void
}
interface SortStrategy {
+sort(words : String[]) : void
}
class MergeSort {
+sort(words : String[]) : void
}
class ShellSort {
+sort(words : String[]) : void
}
class QuickSort {
+sort(words : String[]) : void
}
WordList --> "1" SortStrategy : -currentStrategy
MergeSort ..|> SortStrategy
ShellSort ..|> SortStrategy
QuickSort ..|> SortStrategy
note right of WordList
public void sort() {
currentStrategy.sort(words);
}
end note
@enduml

Class diagram with 5 class(es) and 4 relation(s).

Classes:

  • Class WordList with:
    • public method 'sort', without parameters, return type void
    • public method 'setSortStrategy', with parameter(s) 'strategy' of type SortStrategy, return type void
    • private attribute 'words' of type String Array
  • Interface SortStrategy with:
    • public method 'sort', with parameter(s) 'words' of type String[], return type void
    • no attributes
  • Class MergeSort with:
    • public method 'sort', with parameter(s) 'words' of type String[], return type void
    • no attributes
  • Class ShellSort with:
    • public method 'sort', with parameter(s) 'words' of type String[], return type void
    • no attributes
  • Class QuickSort with:
    • public method 'sort', with parameter(s) 'words' of type String[], return type void
    • no attributes

Relations:

  • WordList has an association-relationship named '-currentStrategy' with SortStrategy, multiplicity 1
  • MergeSort implements interface SortStrategy
  • ShellSort implements interface SortStrategy
  • QuickSort implements interface SortStrategy

Screen reader text (English):

Class diagram with 5 classes and 4 relationships.

Classes:

  • Class WordList with:
    • Private attribute words of type String Array
    • Public method sort, without parameters, return type void
    • Public method setSortStrategy with parameter strategy of type SortStrategy, return type void
  • Interface SortStrategy with public method sort with parameter words of type String Array, return type void
  • Class MergeSort with public method sort with parameter words of type String Array, return type void
  • Class ShellSort with public method sort with parameter words of type String Array, return type void
  • Class QuickSort with public method sort with parameter words of type String Array, return type void Relations:
  • WordList has an association-relationship named 'currentStrategy' with SortStrategy, multiplicity 1
  • MergeSort implements interface SortStrategy
  • ShellSort implements interface SortStrategy
  • QuickSort implements interface SortStrategy Notes:
  • At class WordList: "The sort method calls currentStrategy.sort with words as parameter"

Simple class diagram without Out loud button

This diagram has the Out loud button hidden via the hideSpeakButton flag, demonstrating per-diagram control over the speak button.

WordList class (no speak button)

PlantUML source for "WordList class (no speak button)"
@startuml
class WordList {
-words : String[]
+sort() : void
}
@enduml

Class diagram with 1 class(es) and 0 relation(s).

Classes:

  • Class WordList with:
    • public method 'sort', without parameters, return type void
    • private attribute 'words' of type String Array