Created
May 20, 2019 06:19
-
-
Save hackjutsu/b08a7f98df0d2d973843f784a0c5de22 to your computer and use it in GitHub Desktop.
[medium snippets] #medium #designPattern #ProxyPattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProxyImage implements Image{ | |
private RealImage realImage; | |
private String fileName; | |
public ProxyImage(String fileName){ | |
this.fileName = fileName; | |
} | |
@Override | |
public void display() { | |
if(realImage == null){ | |
realImage = new RealImage(fileName); | |
} | |
realImage.display(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment