-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
23 lines (19 loc) · 777 Bytes
/
Copy pathMain.java
File metadata and controls
23 lines (19 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import builder.HouseDirector;
import builder.IHouseBuilder;
import builder.TownhouseBuilder;
import builder.VillaBuilder;
import house.House;
public class Main {
public static void main(String[] args) {
// just need to change the concrete builder and will be able to create a coherent set of house features
IHouseBuilder[] builders = new IHouseBuilder[]{new TownhouseBuilder(), new VillaBuilder()};
for (IHouseBuilder builder : builders) {
System.out.println(builder.getClass());
HouseDirector director = new HouseDirector(builder);
director.constructHouse();
House house = director.getHouse();
System.out.println(house.toString());
System.out.println();
}
}
}