-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClient.java
More file actions
18 lines (15 loc) · 765 Bytes
/
Copy pathClient.java
File metadata and controls
18 lines (15 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package structural_patterns.wrapper;
public class Client {
public static void main(String[] args){
Component decorator1 = new ExplicitDecoratorA();
Component decorator2 = new ExplicitDecoratorB();
Component decorator3 = new ExplicitDecoratorA();
((ExplicitDecoratorA) decorator1).addComponent(decorator2);
((ExplicitDecoratorA) decorator1).addComponent(decorator3);
((ExplicitDecoratorA) decorator1).addComponent(new ExplicitObject());
((ExplicitDecoratorB) decorator2).addComponent(new ExplicitObject());
((ExplicitDecoratorB) decorator2).addComponent(new ExplicitObject());
((ExplicitDecoratorA) decorator3).addComponent(new ExplicitObject());
decorator1.operation();
}
}