Design Patterns Proxy Pattern - Design Patterns

What is Design Patterns Proxy Pattern?

In proxy pattern, a division represents functionality of another class. This kind of design pattern comes under structural pattern.
In proxy pattern, we build object having original object to line its functionality to external world.

Implementation

We are available to make an Image interface and concrete classes implementing the Image interface. Proxy Image is a proxy class to decrease memory footprint of Real Image object loading.

ProxyPatternDemo, our demo class, will use Proxy Image to get an Image entity to load and display as it requirements.
proxy_pattern_uml_diagram

Step 1

Create an interface.

Image.java

Step 2

Create concrete classes implementing the similar interface.

RealImage.java

ProxyImage.java

Step 3

Use the Proxy Image to get entity of Real Image class when necessary.

ProxyPatternDemo.java

Step 4

Verify the output.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Design Patterns Topics