-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhoneBuilder.java
More file actions
36 lines (29 loc) · 1.04 KB
/
PhoneBuilder.java
File metadata and controls
36 lines (29 loc) · 1.04 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
package Java.BuilderDesignPatternExample;
public class PhoneBuilder {
private String os;
private String processor;
private float screenSize;
private int batteryCapacity;
private int cameraPixel;
private boolean vrSupport;
public PhoneBuilder(String os, String processor, float screenSize, int batteryCapacity, int cameraPixel) {
this.os = os;
this.processor = processor;
this.screenSize = screenSize;
this.batteryCapacity = batteryCapacity;
this.cameraPixel = cameraPixel;
}
public PhoneBuilder setVRSupport(boolean vrSupport) {
this.vrSupport = vrSupport;
return this;
}
public Phone build() {
return new Phone(this);
}
public String getOS() { return os; }
public String getProcessor() { return processor; }
public float getScreenSize() { return screenSize; }
public int getBatteryCapacity() { return batteryCapacity; }
public int getCameraPixel() { return cameraPixel; }
public boolean getVRSupport() { return vrSupport; }
}