![Spring 5 Design Patterns](https://wfqqreader-1252317822.image.myqcloud.com/cover/646/36700646/b_36700646.jpg)
上QQ阅读APP看书,第一时间看更新
UML class structure
The following UML diagram shows all the components of the Prototype design pattern:
![](https://epubservercos.yuewen.com/5098A3/19470402901614006/epubprivate/OEBPS/Images/7d707f1e-6cb1-491f-9ac8-aa3b634fb6ad.png?sign=1739222299-vZwiZc9iH756dSALgtooNpRrsfH5tEhx-0-a03357ca3fa07ee7cb96bbb715243c5a)
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.