01: package invoice;
02:
03: import java.util.Collection;
04: import java.util.Iterator;
05:
06: /**
07: * @author S.Chassande-Barrioz
08: */
09: public class Invoice {
10: private int number;
11: private Address address = null;
12: private Collection productUnits = null;
13:
14: public Invoice() {
15: }
16:
17: public Invoice(int number, Address address, Collection productUnits) {
18: this .number = number;
19: this .address = address;
20: this .productUnits = productUnits;
21: }
22:
23: public String toString() {
24: StringBuffer res = new StringBuffer();
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 sep = "";
32: Iterator 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 getProductUnits() {
66: return productUnits;
67: }
68:
69: public void setProductUnits(Collection productUnits) {
70: this.productUnits = productUnits;
71: }
72: }
|