01: package org.springunit.framework.samples.jpetstore.domain;
02:
03: import java.io.Serializable;
04:
05: public class CartItem implements Serializable {
06:
07: public boolean isInStock() {
08: return this .inStock;
09: }
10:
11: public void setInStock(boolean inStock) {
12: this .inStock = inStock;
13: }
14:
15: public Item getItem() {
16: return this .item;
17: }
18:
19: public void setItem(Item item) {
20: this .item = item;
21: }
22:
23: public int getQuantity() {
24: return this .quantity;
25: }
26:
27: public void setQuantity(int quantity) {
28: this .quantity = quantity;
29: }
30:
31: public double getTotalPrice() {
32: if (item != null) {
33: return item.getListPrice() * quantity;
34: } else {
35: return 0;
36: }
37: }
38:
39: public void incrementQuantity() {
40: this .quantity++;
41: }
42:
43: private static final long serialVersionUID = 7L;
44:
45: private Item item;
46: private int quantity;
47: private boolean inStock;
48:
49: }
|