@startuml package com.iluwatar.flyweight { class PotionFactory { - potions : Map + PotionFactory() ~ createPotion(type : PotionType) : Potion } class HealingPotion { + HealingPotion() + drink() } class InvisibilityPotion { + InvisibilityPotion() + drink() } class AlchemistShop { - bottomShelf : List - topShelf : List + AlchemistShop() + enumerate() - fillShelves() + getBottomShelf() : List + getTopShelf() : List } class App { + App() + main(args : String[]) {static} } interface Potion { + drink() {abstract} } class PoisonPotion { + PoisonPotion() + drink() } class StrengthPotion { + StrengthPotion() + drink() } class HolyWaterPotion { + HolyWaterPotion() + drink() } enum PotionType { + HEALING {static} + HOLY_WATER {static} + INVISIBILITY {static} + POISON {static} + STRENGTH {static} + valueOf(name : String) : PotionType {static} + values() : PotionType[] {static} } } AlchemistShop --> "-topShelf" Potion HealingPotion ..|> Potion InvisibilityPotion ..|> Potion PoisonPotion ..|> Potion StrengthPotion ..|> Potion HolyWaterPotion ..|> Potion @enduml