-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVendor.java
More file actions
56 lines (44 loc) · 1.35 KB
/
Vendor.java
File metadata and controls
56 lines (44 loc) · 1.35 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
49
50
51
52
53
54
55
56
package Model;
import java.util.Objects;
public class Vendor {
// We have getters and setter so that we can control how these fields are accessed. Making them
// private forces consumers to use these methods instead of accessing the fields directly.
private int vendorId;
private String vendorName;
public Vendor(){
}
public Vendor(int vendorId, String vendorName) {
this.vendorId = vendorId;
this.vendorName = vendorName;
}
public int getVendorId() {
return vendorId;
}
public void setVendorId(int vendorId) {
this.vendorId = vendorId;
}
public String getVendorName() {
return vendorName;
}
public void setVendorName(String vendorName) {
this.vendorName = vendorName;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Vendor vendor = (Vendor) o;
return vendorId == vendor.vendorId && Objects.equals(vendorName, vendor.vendorName);
}
@Override
public int hashCode() {
return Objects.hash(vendorId, vendorName);
}
@Override
public String toString() {
return "Vendor{" +
"vendorId=" + vendorId +
", vendorName='" + vendorName + '\'' +
'}';
}
}