![Building Microservices with Spring](https://wfqqreader-1252317822.image.myqcloud.com/cover/86/36699086/b_36699086.jpg)
上QQ阅读APP看书,第一时间看更新
UML class structure
The following UML diagram shows all the components of the Prototype design pattern:
![](https://epubservercos.yuewen.com/ACD8B1/19470384008836706/epubprivate/OEBPS/Images/cadd483b-553b-47db-99db-23cb483d6766.png?sign=1738853932-XgVoOBHYHC1ljaLJZivAxF6VDFV2rwgA-0-4337a3b500844a8e44f03ae89016bb43)
UML diagram for Prototype design pattern
Let's see these components as listed in following points:
- Prototype: The Prototype is an interface. It is uses the clone method to create instances of this interface type.
- ConcretePrototype: This is a concrete class of the Prototype interface to implement an operation to clone itself.
- Client: This is a caller class to create a new object of a Prototype interface by calling a clone method of the prototype interface.
Let's see a sample implementation of the prototype design pattern.