1 | public static class Id implements Serializable {↵ | | 1 | public static class Id implements Serializable {↵
|
2 | private String customerId;↵ | | 2 | private int purchaseNumber;↵
|
3 | private int orderNumber;↵ | | 3 | private String purchaseSequence;↵
|
|
4 | public Id(String customerId, int orderNumber) {↵ | | 4 | public Id(↵
|
5 | this.customerId = customerId;↵ | | |
|
6 | this.orderNumber = orderNumber↵ | | 5 | int purchaseNumber, String purchaseSequence) {↵
|
| | | 6 | this.purchaseNumber = purchaseNumber;↵
|
7 | ;↵ | | 7 | this.purchaseSequence = purchaseSequence;↵
|
8 | }↵ | | 8 | }↵
|
9 | public Id() {}↵ | | 9 | public Id() {}↵
|
|
10 | /**↵ | | 10 | /**↵
|
11 | * @return Returns the customerId.↵ | | 11 | * @return Returns the purchaseNumber.↵
|
12 | */↵ | | 12 | */↵
|
13 | public String getCustomerId() {↵ | | 13 | public int getPurchaseNumber() {↵
|
14 | return customerId;↵ | | 14 | return purchaseNumber;↵
|
15 | }↵ | | 15 | }↵
|
16 | /**↵ | | 16 | /**↵
|
17 | * @param customerId The customerId to set.↵ | | 17 | * @param purchaseNumber The purchaseNumber to set.↵
|
18 | */↵ | | 18 | */↵
|
19 | public void setCustomerId(String customerId) {↵ | | 19 | public void set↵
|
20 | this.customerId = customerId↵ | | 20 | PurchaseNumber(int purchaseNumber) {↵
|
21 | ;↵ | | 21 | this.purchaseNumber = purchaseNumber;↵
|
22 | }↵ | | 22 | }↵
|
23 | /**↵ | | 23 | /**↵
|
24 | * @return Returns the orderNumber.↵ | | 24 | * @return the purchaseSequence↵
|
25 | */↵ | | 25 | */↵
|
26 | public int getOrderNumber() {↵ | | 26 | public String get↵
|
27 | return orderNumber↵ | | 27 | PurchaseSequence() {↵
|
28 | ;↵ | | 28 | return purchaseSequence;↵
|
29 | }↵ | | 29 | }↵
|
30 | /**↵ | | 30 | /**↵
|
31 | * @param orderNumber The orderNumber to set.↵ | | 31 | * @param purchaseSequence the purchaseSequence to set↵
|
32 | */↵ | | 32 | */↵
|
33 | public void setOrderNumber(int orderNumber) {↵ | | 33 | public void set↵
|
34 | this.orderNumber = orderNumber;↵ | | |
|
35 | }↵ | | |
|
36 | public int hashCode() {↵ | | |
|
37 | return customerId.hashCode() + orderNumber↵ | | 34 | PurchaseSequence(String purchaseSequence) {↵
|
| | | 35 | this.purchaseSequence = purchaseSequence;↵
|
| | | 36 | }↵
|
| | | 37 | public int hashCode() {↵
|
38 | ;↵ | | 38 | return purchaseNumber + purchaseSequence.hashCode();↵
|
39 | }↵ | | 39 | }↵
|
40 | public boolean equals(Object other) {↵ | | 40 | public boolean equals(Object other) {↵
|
41 | if (other instanceof Id) {↵ | | 41 | if (other instanceof Id) {↵
|
42 | Id that = (Id) other;↵ | | 42 | Id that = (Id) other;↵
|
43 | return that.customerId.equals(this.customerId) &&↵ | | 43 | return purchaseSequence.equals(this.purchaseSequence) &&↵
|
44 | that.orderNumber == this.orderNumber;↵ | | 44 | that.purchaseNumber == this.purchaseNumber;↵
|
45 | }↵ | | 45 | }↵
|
46 | else {↵ | | 46 | else {↵
|
47 | return false | | 47 | return false
|