Skip to content

Instantly share code, notes, and snippets.

@hackjutsu
Created May 20, 2019 06:19
Show Gist options
  • Save hackjutsu/b08a7f98df0d2d973843f784a0c5de22 to your computer and use it in GitHub Desktop.
Save hackjutsu/b08a7f98df0d2d973843f784a0c5de22 to your computer and use it in GitHub Desktop.
[medium snippets] #medium #designPattern #ProxyPattern
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