KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > performance > PerfArticleImpl


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

21
22 /**
23  * Implementation of the {@link PerfArticle} interface.
24  *
25  * @version $Id: PerfArticleImpl.java,v 1.6.2.3 2005/12/30 00:01:42 arminw Exp $
26  */

27 public class PerfArticleImpl implements PerfArticle
28 {
29     private Long JavaDoc articleId;
30     private String JavaDoc articleName;
31     private int minimumStock;
32     private double price;
33     private String JavaDoc unit;
34     private int stock;
35     private int supplierId;
36     private int productGroupId;
37
38     public PerfArticleImpl()
39     {
40     }
41
42     public PerfArticleImpl(Long JavaDoc articleId, String JavaDoc articleName, int minimumStock, double price, String JavaDoc unit, int stock, int supplierId, int productGroupId)
43     {
44         this.articleId = articleId;
45         this.articleName = articleName;
46         this.minimumStock = minimumStock;
47         this.price = price;
48         this.unit = unit;
49         this.stock = stock;
50         this.supplierId = supplierId;
51         this.productGroupId = productGroupId;
52     }
53
54     public String JavaDoc toString()
55     {
56         return new ToStringBuilder(this).append("articleId", articleId)
57                 .append("articleName", articleName)
58                 .append("minimumStock", minimumStock)
59                 .append("price", price)
60                 .append("unit", unit)
61                 .append("stock", stock)
62                 .append("supplierId", supplierId)
63                 .append("productGroupId", productGroupId)
64                 .toString();
65     }
66
67     public Long JavaDoc getArticleId()
68     {
69         return articleId;
70     }
71
72     public void setArticleId(Long JavaDoc articleId)
73     {
74         this.articleId = articleId;
75     }
76
77     public String JavaDoc getArticleName()
78     {
79         return articleName;
80     }
81
82     public void setArticleName(String JavaDoc articleName)
83     {
84         this.articleName = articleName;
85     }
86
87     public int getMinimumStock()
88     {
89         return minimumStock;
90     }
91
92     public void setMinimumStock(int minimumStock)
93     {
94         this.minimumStock = minimumStock;
95     }
96
97     public double getPrice()
98     {
99         return price;
100     }
101
102     public void setPrice(double price)
103     {
104         this.price = price;
105     }
106
107     public String JavaDoc getUnit()
108     {
109         return unit;
110     }
111
112     public void setUnit(String JavaDoc unit)
113     {
114         this.unit = unit;
115     }
116
117     public int getStock()
118     {
119         return stock;
120     }
121
122     public void setStock(int stock)
123     {
124         this.stock = stock;
125     }
126
127     public int getSupplierId()
128     {
129         return supplierId;
130     }
131
132     public void setSupplierId(int supplierId)
133     {
134         this.supplierId = supplierId;
135     }
136
137     public int getProductGroupId()
138     {
139         return productGroupId;
140     }
141
142     public void setProductGroupId(int productGroupId)
143     {
144         this.productGroupId = productGroupId;
145     }
146
147     public int hashCode()
148     {
149         return new HashCodeBuilder().append(articleId).hashCode();
150     }
151
152     public boolean equals(Object JavaDoc obj)
153     {
154         if(obj == this)
155         {
156             return true;
157         }
158         if(obj instanceof PerfArticleImpl)
159         {
160             PerfArticleImpl o = (PerfArticleImpl) obj;
161             return new EqualsBuilder()
162                     .append(articleId, o.articleId)
163                     .append(articleName, o.articleName)
164                     .append(minimumStock, o.minimumStock)
165                     .append(price, o.price)
166                     .append(productGroupId, o.productGroupId)
167                     .append(stock, o.stock)
168                     .append(supplierId, o.supplierId)
169                     .append(unit, o.unit)
170                     .isEquals();
171         }
172         return false;
173     }
174 }
175
Popular Tags