forked from shabbirdwd53/design_patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMeal.java
More file actions
48 lines (40 loc) · 1.45 KB
/
Copy pathMeal.java
File metadata and controls
48 lines (40 loc) · 1.45 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* If we go via GOF Definition "The intent of the Builder design pattern is to separate the construction of a complex object from its representation. By doing so, the same construction process can create different representations.:
* It means for this Meal class lets say we have different representation which VegMeal and NonVegMeal
* Also this helps when you want to create object step by step too.
* So to achieve GOF we have following components as part builder pattern.
* 1. Product - Which we are building
* 2. AbstractBuilder - Which is helpful to provide the product
* 3. Concrete builder : It is actual builder which helps us to provide specific representation of the object.
* 4. Director : Which uses this concrete builder and provides the
*/
public class Meal {
private String curry;
private String bread;
private String coldDrink;
private String briyani;
public String getCurry() {
return curry;
}
public void setCurry(String curry) {
this.curry = curry;
}
public String getBread() {
return bread;
}
public void setBread(String bread) {
this.bread = bread;
}
public String getColdDrink() {
return coldDrink;
}
public void setColdDrink(String coldDrink) {
this.coldDrink = coldDrink;
}
public String getBriyani() {
return briyani;
}
public void setBriyani(String briyani) {
this.briyani = briyani;
}
}