@startuml
package com.iluwatar.abstractfactory {
  class App {
    - army : Army
    - castle : Castle
    - king : King
    + App()
    + createKingdom(factory : KingdomFactory)
    + getArmy() : Army
    ~ getArmy(factory : KingdomFactory) : Army
    + getCastle() : Castle
    ~ getCastle(factory : KingdomFactory) : Castle
    + getKing() : King
    ~ getKing(factory : KingdomFactory) : King
    + main(args : String[]) {static}
    - setArmy(army : Army)
    - setCastle(castle : Castle)
    - setKing(king : King)
  }
  class OrcKingdomFactory {
    + OrcKingdomFactory()
    + createArmy() : Army
    + createCastle() : Castle
    + createKing() : King
  }
  class ElfCastle {
    ~ DESCRIPTION : String {static}
    + ElfCastle()
    + getDescription() : String
  }
  class OrcCastle {
    ~ DESCRIPTION : String {static}
    + OrcCastle()
    + getDescription() : String
  }
  interface KingdomFactory {
    + createArmy() : Army {abstract}
    + createCastle() : Castle {abstract}
    + createKing() : King {abstract}
  }
  class ElfKing {
    ~ DESCRIPTION : String {static}
    + ElfKing()
    + getDescription() : String
  }
  class ElfArmy {
    ~ DESCRIPTION : String {static}
    + ElfArmy()
    + getDescription() : String
  }
  interface Castle {
    + getDescription() : String {abstract}
  }
  interface Army {
    + getDescription() : String {abstract}
  }
  class OrcKing {
    ~ DESCRIPTION : String {static}
    + OrcKing()
    + getDescription() : String
  }
  class OrcArmy {
    ~ DESCRIPTION : String {static}
    + OrcArmy()
    + getDescription() : String
  }
  interface King {
    + getDescription() : String {abstract}
  }
  class ElfKingdomFactory {
    + ElfKingdomFactory()
    + createArmy() : Army
    + createCastle() : Castle
    + createKing() : King
  }
}
App -->  "-castle" Castle
App -->  "-king" King
App -->  "-army" Army
OrcKingdomFactory ..|> KingdomFactory 
ElfCastle ..|> Castle 
OrcCastle ..|> Castle 
ElfKing ..|> King 
ElfArmy ..|> Army 
OrcKing ..|> King 
OrcArmy ..|> Army 
ElfKingdomFactory ..|> KingdomFactory 
@enduml