KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > pets > domain > model > pojo > BasketItem


1 package org.apache.tapestry.pets.domain.model.pojo;
2
3 import java.io.Serializable JavaDoc;
4 import java.math.BigDecimal JavaDoc;
5
6 import org.apache.tapestry.pets.domain.model.IBasketItem;
7
8 /**
9  * A line item in the shopping cart.
10  */

11 public class BasketItem implements IBasketItem,Serializable JavaDoc
12 {
13     // private properties
14
private String JavaDoc itemID;
15     private String JavaDoc name;
16     private int qty;
17     private BigDecimal JavaDoc price;
18     private double total;
19     private boolean inStock;
20
21     /**
22      * Init item with values.
23      *
24      *@param itemID Product item.
25      *@param name Item name.
26      *@param inStock True if in stock, otherwise false.
27      *@param qty Quantity.
28      *@param price Item price.
29      */

30     public BasketItem(String JavaDoc itemID, String JavaDoc name, boolean inStock, int qty, BigDecimal JavaDoc price)
31     {
32         // save to class members
33
this.setItemID(itemID);
34         this.setName(name);
35         this.setQty(qty);
36         this.setPrice(price);
37         this.setTotal(total);
38         this.setInStock(inStock);
39     }
40
41     public void setItemID(String JavaDoc itemID)
42     {
43         this.itemID = itemID;
44     }
45
46     public String JavaDoc getItemID()
47     {
48         return itemID;
49     }
50
51     public void setName(String JavaDoc name)
52     {
53         this.name = name;
54     }
55
56     public String JavaDoc getName()
57     {
58         return name;
59     }
60
61     public void setQty(int qty)
62     {
63         this.qty = qty;
64     }
65
66     public int getQty()
67     {
68         return qty;
69     }
70
71     public void setPrice(BigDecimal JavaDoc price)
72     {
73         this.price = price;
74     }
75
76     public BigDecimal JavaDoc getPrice()
77     {
78         return price;
79     }
80
81     public void setTotal(double total)
82     {
83         this.total = total;
84     }
85
86     public double getTotal()
87     {
88         return total;
89     }
90
91     public void setInStock(boolean inStock)
92     {
93         this.inStock = inStock;
94     }
95
96     public boolean getInStock()
97     {
98         return inStock;
99     }
100 }
101
Popular Tags