KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > olstore > client > Item


1 /**
2  * Copyright (c) 2005 Red Hat, Inc. All rights reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA
18  *
19  * Component of: Red Hat Application Server
20  *
21  * Initial Developers: Gregory Lapouchnian
22  * Patrick Smith
23  * --------------------------------------------------------------------------
24  * $Id: Item.java,v 1.2 2005/07/08 14:00:45 glapouch Exp $
25  * --------------------------------------------------------------------------
26  */

27 package olstore.client;
28
29 import java.awt.image.BufferedImage;
30
31 /**
32  * A representation of a single item on sale in the store.
33  */

34 public class Item {
35
36     /** The title of this item. */
37     private String title;
38
39     /** The description for this item. */
40     private String description;
41
42     /** The price of this item. */
43     private String price;
44
45     /** The product category for this item. */
46     private String category;
47
48     /** The unique ID for this item. */
49     private String id;
50
51     /** The image for this item. */
52     private BufferedImage image;
53
54     /**
55      * A single item from the catalog.
56      * @param title item's name
57      * @param description item's description
58      * @param price the price
59      * @param category the product category
60      * @param id the unique ID
61      * @param image an image showing this item
62      */

63     public Item(String title, String description, String price,
64             String category, String id, BufferedImage image) {
65
66         this.title = title;
67         this.description = description;
68         this.price = price;
69         this.category = category;
70         this.id = id;
71         this.image = image;
72     }
73
74     /**
75      * Get the product category.
76      * @return Returns the category.
77      */

78     public String getCategory() {
79         return category;
80     }
81
82     /**
83      * Set the product category.
84      * @param category The category to set.
85      */

86     public void setCategory(String category) {
87         this.category = category;
88     }
89
90     /**
91      * Get the description of this item.
92      * @return Returns the description.
93      */

94     public String getDescription() {
95         return description;
96     }
97
98     /**
99      * Set the description for this item.
100      * @param description
101      * The description to set.
102      */

103     public void setDescription(String description) {
104         this.description = description;
105     }
106
107     /**
108      * Get the image showing this item.
109      * @return Returns the image.
110      */

111     public BufferedImage getImage() {
112         return image;
113     }
114
115     /**
116      * Set the image that represents this item.
117      * @param image The image to set.
118      */

119     public void setImage(BufferedImage image) {
120         this.image = image;
121     }
122
123     /**
124      * Get the price for this item.
125      * @return Returns the price.
126      */

127     public String getPrice() {
128         return price;
129     }
130
131     /**
132      * Set the price for this item.
133      * @param price The price to set.
134      */

135     public void setPrice(String price) {
136         this.price = price;
137     }
138
139     /**
140      * Get the title for this item.
141      * @return Returns the title.
142      */

143     public String getTitle() {
144         return title;
145     }
146
147     /**
148      * Set the title for this item.
149      * @param title The title to set.
150      */

151     public void setTitle(String title) {
152         this.title = title;
153     }
154
155     /**
156      * Get the ID for this item.
157      * @return The ID for this item.
158      */

159     public String getId() {
160         return id;
161     }
162 }
163
Popular Tags