abstract factory pattern
https://plantuml-proxy.vercel.app/svg/https://scrapbox.io/api/code/suto3/abstract_factory_pattern/AbstractFactory.uml#.svg
code:AbstractFactory.uml
@startuml
title Abstract Factory
class Client
package AbstractFactory {
interface AbstractFactory {
--
+ createProductA(): ProductA
+ createProductB(): ProductB
}
class FactoryA {
--
+ createProductA(): ProductA
+ createProductB(): ProductB
}
class FactoryB {
--
+ createProductA(): ProductA
+ createProductB(): ProductB
}
}
package Product {
interface ProductA
class ProductA1
class ProductA2
interface ProductB
class ProductB1
class ProductB2
}
Client ..> AbstractFactory : use
Client ..> ProductA : use
Client ..> ProductB : use
AbstractFactory <|.. FactoryA
AbstractFactory <|.. FactoryB
ProductA <|.. ProductA1
ProductA <|.. ProductA2
ProductB <|.. ProductB1
ProductB <|.. ProductB2
ProductA1 <.. FactoryA : create
ProductB1 <.. FactoryA : create
ProductA2 <.. FactoryB : create
ProductB2 <.. FactoryB : create
@enduml