-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
32 lines (20 loc) · 1006 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.progresspoint.patterns;
import com.progresspoint.patterns.creational_patterns.singleton.SingletonSimple;
import com.progresspoint.patterns.structural_patterns.proxy.Proxy;
import com.progresspoint.patterns.structural_patterns.proxy.SomeOtherThing;
public class Main {
public static void main(String[] args) {
// Singleton simple demo
System.out.println("\nSINGLETON\n");
SingletonSimple simpleEdek = SingletonSimple.getInstance("Edek");
System.out.println("Singleton instance will create Edek : " + simpleEdek.getGreetings());
SingletonSimple simpleKarol = SingletonSimple.getInstance("Karol");
System.out.println("But hen we want to create Karol, this doesnt work : " + simpleKarol.getGreetings());
// PROXY DEMO
System.out.println("\nPROXY\n");
Proxy proxy = new Proxy();
SomeOtherThing someOtherThing = new SomeOtherThing();
someOtherThing.sayHeloo();
proxy.sayHello();
}
}