1919
2020import com .labs64 .netlicensing .domain .Constants ;
2121import com .labs64 .netlicensing .domain .entity .Product ;
22+ import com .labs64 .netlicensing .domain .entity .ProductDiscount ;
2223import com .labs64 .netlicensing .domain .vo .Currency ;
2324import com .labs64 .netlicensing .domain .vo .Money ;
2425
2526/**
2627 * Represents discount step as a discount amount (absolute or percentage) after total price reaches the given threshold.
2728 */
28- public class ProductDiscount implements Comparable < ProductDiscount > , Serializable {
29+ public class ProductDiscountImpl implements ProductDiscount , Serializable {
2930
3031 private static final long serialVersionUID = -8665112497261365879L ;
3132
@@ -39,51 +40,61 @@ public class ProductDiscount implements Comparable<ProductDiscount>, Serializabl
3940
4041 private BigDecimal amountPercent ;
4142
42- public Product getProduct () {
43- return product ;
44- }
45-
43+ @ Override
4644 public void setProduct (final Product product ) {
4745 this .product = product ;
4846 }
4947
50- public BigDecimal getTotalPrice () {
51- return totalPrice ;
48+ @ Override
49+ public Product getProduct () {
50+ return product ;
5251 }
5352
53+ @ Override
5454 public void setTotalPrice (final BigDecimal totalPrice ) {
5555 this .totalPrice = totalPrice ;
5656 }
5757
58- public String getCurrency () {
59- return currency ;
58+ @ Override
59+ public BigDecimal getTotalPrice () {
60+ return totalPrice ;
6061 }
6162
63+ @ Override
6264 public void setCurrency (final String currency ) {
6365 this .currency = currency ;
6466 }
6567
66- public BigDecimal getAmountFix () {
67- return amountFix ;
68+ @ Override
69+ public String getCurrency () {
70+ return currency ;
6871 }
6972
73+ @ Override
7074 public void setAmountFix (final BigDecimal amountFix ) {
7175 this .amountFix = amountFix ;
7276 amountPercent = null ;
7377 }
7478
75- public BigDecimal getAmountPercent () {
76- return amountPercent ;
79+ @ Override
80+ public BigDecimal getAmountFix () {
81+ return amountFix ;
7782 }
7883
84+ @ Override
7985 public void setAmountPercent (final BigDecimal amountPercent ) {
8086 this .amountPercent = amountPercent ;
8187 amountFix = null ;
8288 }
8389
90+ @ Override
91+ public BigDecimal getAmountPercent () {
92+ return amountPercent ;
93+ }
94+
8495 /**
8596 * Gets the discount amount as string, with '%' sign at the end indicating discount is given in percent.
86- *
97+ *
8798 * @return the string amount
8899 */
89100 public String getStringAmount () {
@@ -98,7 +109,7 @@ public String getStringAmount() {
98109
99110 /**
100111 * Sets the discount amount from string, '%' sign at the end indicates discount is provided in percent.
101- *
112+ *
102113 * @param amount
103114 * discount amount as string
104115 */
@@ -145,7 +156,7 @@ public String toString() {
145156
146157 @ Override
147158 public int compareTo (final ProductDiscount productDiscount ) {
148- return productDiscount .totalPrice .compareTo (totalPrice ); // reverse order!
159+ return productDiscount .getTotalPrice () .compareTo (totalPrice ); // reverse order!
149160 }
150161
151162}
0 commit comments