KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > invoice > Invoice


1 package invoice;
2
3 import java.util.Collection JavaDoc;
4 import java.util.Iterator JavaDoc;
5
6 /**
7  * @author S.Chassande-Barrioz
8  */

9 public class Invoice {
10     private int number;
11     private Address address = null;
12     private Collection JavaDoc productUnits = null;
13
14     public Invoice() {
15     }
16
17     public Invoice(int number, Address address, Collection JavaDoc productUnits) {
18         this.number = number;
19         this.address = address;
20         this.productUnits = productUnits;
21     }
22
23     public String JavaDoc toString() {
24         StringBuffer JavaDoc res = new StringBuffer JavaDoc();
25         res.append("number:");
26         res.append(number);
27         res.append(" / address: (");
28         res.append(address);
29         res.append(") / productUnits: ");
30         if (productUnits != null) {
31             String JavaDoc sep = "";
32             Iterator JavaDoc it = productUnits.iterator();
33             if (it.hasNext()) {
34                 res.append("\n\t");
35             }
36             res.append("[");
37             while(it.hasNext()) {
38                 res.append(sep);
39                 sep = ",\n\t";
40                 res.append('(');
41                 res.append((ProductUnits) it.next());
42                 res.append(')');
43             }
44             res.append("]");
45         }
46         return res.toString();
47     }
48
49     public int getNumber() {
50         return number;
51     }
52
53     public void setNumber(int number) {
54         this.number = number;
55     }
56
57     public Address getAddress() {
58         return address;
59     }
60
61     public void setAddress(Address address) {
62         this.address = address;
63     }
64
65     public Collection JavaDoc getProductUnits() {
66         return productUnits;
67     }
68
69     public void setProductUnits(Collection JavaDoc productUnits) {
70         this.productUnits = productUnits;
71     }
72 }
73
Popular Tags