- Building Microservices with Spring
- Dinesh Rajput Rajesh R V
- 101字
- 2021-07-02 14:54:03
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=1739656745-0dm4QaYLoVuD0qRFxDshH5dz2sQcLDDv-0-9bd29629f0ca0b2564e01b344775820f)
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.