KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > ejb > ArticleVO


1 package org.apache.ojb.ejb;
2
3 /* Copyright 2003-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import java.io.Serializable JavaDoc;
19 import java.math.BigDecimal JavaDoc;
20
21 import org.apache.commons.lang.builder.ToStringBuilder;
22
23 /**
24  *
25  * @author <a HREF="mailto:armin@codeAuLait.de">Armin Waibel</a>
26  * @version $Id: ArticleVO.java,v 1.6.2.1 2005/12/21 22:21:38 tomdz Exp $
27  */

28 public class ArticleVO implements Serializable JavaDoc
29 {
30     private Integer JavaDoc articleId;
31     private String JavaDoc name;
32     private BigDecimal JavaDoc price;
33     private String JavaDoc description;
34     private Integer JavaDoc categoryId;
35     private CategoryVO category;
36
37     public ArticleVO(Integer JavaDoc articleId, String JavaDoc name, String JavaDoc description, BigDecimal JavaDoc price, Integer JavaDoc categoryId)
38     {
39         this.articleId = articleId;
40         this.name = name;
41         this.description = description;
42         this.price = price;
43         this.categoryId = categoryId;
44     }
45
46     public ArticleVO()
47     {
48     }
49
50     public CategoryVO getCategory()
51     {
52         return category;
53     }
54
55     public void setCategory(CategoryVO category)
56     {
57         this.category = category;
58     }
59
60     public Integer JavaDoc getArticleId()
61     {
62         return articleId;
63     }
64
65     public void setArticleId(Integer JavaDoc articleId)
66     {
67         this.articleId = articleId;
68     }
69
70     public String JavaDoc getName()
71     {
72         return name;
73     }
74
75     public void setName(String JavaDoc name)
76     {
77         this.name = name;
78     }
79
80     public String JavaDoc getDescription()
81     {
82         return description;
83     }
84
85     public void setDescription(String JavaDoc description)
86     {
87         this.description = description;
88     }
89
90     public BigDecimal JavaDoc getPrice()
91     {
92         return price;
93     }
94
95     public void setPrice(BigDecimal JavaDoc price)
96     {
97         if(price != null) price.setScale(2, BigDecimal.ROUND_HALF_UP);
98         this.price = price;
99     }
100
101     public Integer JavaDoc getCategoryId()
102     {
103         return categoryId;
104     }
105
106     public void setCategoryId(Integer JavaDoc categoryId)
107     {
108         this.categoryId = categoryId;
109     }
110
111     public String JavaDoc toString()
112     {
113         ToStringBuilder buf = new ToStringBuilder(this);
114         buf.append("articleId", articleId).
115                 append("name", name).
116                 append("description", description).
117                 append("price", price).
118                 append("categoryId", categoryId).
119                 append("category", category);
120         return buf.toString();
121     }
122 }
123
Popular Tags