KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > johnmammen > betterpetshop > bo > Lineitem


1 package johnmammen.betterpetshop.bo;
2
3 import java.io.Serializable JavaDoc;
4 import java.math.BigDecimal JavaDoc;
5
6 import org.apache.commons.lang.builder.EqualsBuilder;
7 import org.apache.commons.lang.builder.HashCodeBuilder;
8 import org.apache.commons.lang.builder.ToStringBuilder;
9 import org.apache.tapestry.pets.domain.model.IItem;
10
11
12
13 /**
14  * @hibernate.class
15  * table="lineitem"
16  *
17 */

18 public class Lineitem implements Serializable JavaDoc {
19
20     /** identifier field */
21     private johnmammen.betterpetshop.bo.LineitemPK comp_id;
22
23     /** persistent field */
24     private int quantity;
25
26     /** persistent field */
27     private BigDecimal JavaDoc unitprice;
28
29     /** nullable persistent field */
30     private org.apache.tapestry.pets.domain.model.IItem item;
31
32     /** full constructor */
33     public Lineitem(johnmammen.betterpetshop.bo.LineitemPK comp_id, int quantity, BigDecimal JavaDoc unitprice, IItem item) {
34         this.comp_id = comp_id;
35         this.quantity = quantity;
36         this.unitprice = unitprice;
37         this.item = item;
38     }
39
40     /** default constructor */
41     public Lineitem() {
42     }
43
44     /** minimal constructor */
45     public Lineitem(johnmammen.betterpetshop.bo.LineitemPK comp_id, int quantity, BigDecimal JavaDoc unitprice) {
46         this.comp_id = comp_id;
47         this.quantity = quantity;
48         this.unitprice = unitprice;
49     }
50
51     public johnmammen.betterpetshop.bo.LineitemPK getComp_id() {
52         return this.comp_id;
53     }
54
55     public void setComp_id(johnmammen.betterpetshop.bo.LineitemPK comp_id) {
56         this.comp_id = comp_id;
57     }
58
59     /**
60      * @hibernate.property
61      * column="quantity"
62      * length="11"
63      * not-null="true"
64      *
65      */

66     public int getQuantity() {
67         return this.quantity;
68     }
69
70     public void setQuantity(int quantity) {
71         this.quantity = quantity;
72     }
73
74     /**
75      * @hibernate.property
76      * column="unitprice"
77      * length="10"
78      * not-null="true"
79      *
80      */

81     public BigDecimal JavaDoc getUnitprice() {
82         return this.unitprice;
83     }
84
85     public void setUnitprice(BigDecimal JavaDoc unitprice) {
86         this.unitprice = unitprice;
87     }
88
89     /**
90      * @hibernate.many-to-one
91      * @hibernate.column name="itemid"
92      *
93      */

94     public IItem getItem() {
95         return this.item;
96     }
97
98     public void setItem(IItem item) {
99         this.item = item;
100     }
101
102     public String JavaDoc toString() {
103         return new ToStringBuilder(this)
104             .append("comp_id", getComp_id())
105             .toString();
106     }
107
108     public boolean equals(Object JavaDoc other) {
109         if ( (other == other ) ) return true;
110         if ( !(other instanceof Lineitem) ) return false;
111         Lineitem castOther = (Lineitem) other;
112         return new EqualsBuilder()
113             .append(this.getComp_id(), castOther.getComp_id())
114             .isEquals();
115     }
116
117     public int hashCode() {
118         return new HashCodeBuilder()
119             .append(getComp_id())
120             .toHashCode();
121     }
122
123 }
124
Popular Tags