Skip to content

Commit 46d0179

Browse files
committed
Proxy design pattern final touch
1 parent d174c87 commit 46d0179

6 files changed

Lines changed: 21 additions & 34 deletions

File tree

pattern/src/com/premaseem/Client.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,28 @@
44
@author: Aseem Jain
55
@title: Design Patterns with Java 9
66
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
7-
@copyright: 2018 Packt Publication
87
*/
98
public class Client {
109
public static void main (String[] args) {
11-
System.out.println("Singleton cook example ");
10+
System.out.println("Proxy iPhone example");
11+
12+
// Programming against interface
13+
IPhone iPhone;
14+
15+
// Loading proxy iPhone for selection purpose
16+
iPhone = new ProxyiPhone();
17+
phoneOperation(iPhone);
18+
19+
iPhone = new RealiPhone();
20+
phoneOperation(iPhone);
21+
22+
}
23+
24+
public static void phoneOperation(IPhone iPhone){
25+
System.out.println();
26+
System.out.println("### Operations running on - "+ iPhone.getClass().getSimpleName());
27+
iPhone.getColor();
28+
iPhone.getDimension();
29+
iPhone.operateDisplay();
1230
}
1331
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

patternBonus/src/com/premaseem/Client.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

patternBonus/src/me/premaseem/proxy/protectiveProxy/ClientForProjectiveProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static void main(String[] args) {
5858
}
5959
System.out.println("=============================");
6060

61-
System.out.println("Press 1 for further treatment and 0 for EXIT .... ");
61+
System.out.println("Press 1 to continue and 0 for EXIT .... ");
6262
try {
6363
repeatRunFlag = scan.nextInt();
6464
} catch (Exception e) {

0 commit comments

Comments
 (0)