1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.batch.sample.domain.order;
18
19 import java.math.BigDecimal;
20
21
22 public class LineItem {
23 public static final String LINE_ID_ITEM = "LIT";
24 private long itemId;
25 private BigDecimal price;
26 private BigDecimal discountPerc;
27 private BigDecimal discountAmount;
28 private BigDecimal shippingPrice;
29 private BigDecimal handlingPrice;
30 private int quantity;
31 private BigDecimal totalPrice;
32
33 public BigDecimal getDiscountAmount() {
34 return discountAmount;
35 }
36
37 public void setDiscountAmount(BigDecimal discountAmount) {
38 this.discountAmount = discountAmount;
39 }
40
41 public BigDecimal getDiscountPerc() {
42 return discountPerc;
43 }
44
45 public void setDiscountPerc(BigDecimal discountPerc) {
46 this.discountPerc = discountPerc;
47 }
48
49 public BigDecimal getHandlingPrice() {
50 return handlingPrice;
51 }
52
53 public void setHandlingPrice(BigDecimal handlingPrice) {
54 this.handlingPrice = handlingPrice;
55 }
56
57 public long getItemId() {
58 return itemId;
59 }
60
61 public void setItemId(long itemId) {
62 this.itemId = itemId;
63 }
64
65 public BigDecimal getPrice() {
66 return price;
67 }
68
69 public void setPrice(BigDecimal price) {
70 this.price = price;
71 }
72
73 public int getQuantity() {
74 return quantity;
75 }
76
77 public void setQuantity(int quantity) {
78 this.quantity = quantity;
79 }
80
81 public BigDecimal getShippingPrice() {
82 return shippingPrice;
83 }
84
85 public void setShippingPrice(BigDecimal shippingPrice) {
86 this.shippingPrice = shippingPrice;
87 }
88
89 public BigDecimal getTotalPrice() {
90 return totalPrice;
91 }
92
93 public void setTotalPrice(BigDecimal totalPrice) {
94 this.totalPrice = totalPrice;
95 }
96
97 @Override
98 public String toString() {
99 return "LineItem [price=" + price + ", quantity=" + quantity + ", totalPrice=" + totalPrice + "]";
100 }
101
102 @Override
103 public int hashCode() {
104 final int prime = 31;
105 int result = 1;
106 result = prime * result + (int) (itemId ^ (itemId >>> 32));
107 result = prime * result + quantity;
108 return result;
109 }
110
111 @Override
112 public boolean equals(Object obj) {
113 if (this == obj)
114 return true;
115 if (obj == null)
116 return false;
117 if (getClass() != obj.getClass())
118 return false;
119 LineItem other = (LineItem) obj;
120 if (itemId != other.itemId)
121 return false;
122 if (quantity != other.quantity)
123 return false;
124 return true;
125 }
126
127 }