KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > bug925693 > Invoice


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

16 package org.apache.myfaces.bug925693;
17 import java.util.ArrayList JavaDoc;
18 import java.util.List JavaDoc;
19
20 public class Invoice
21 {
22     private String JavaDoc invoiceNumber;
23     private String JavaDoc purchaser;
24     private List JavaDoc lineItems = new ArrayList JavaDoc();
25     
26     public Invoice()
27     {
28         setInvoiceNumber("34324234");
29         setPurchaser("Arthur");
30         
31         LineItem firstItem = new LineItem();
32         firstItem.setProduct("Product 1");
33         firstItem.setQuantity("10");
34         
35         lineItems.add(firstItem);
36     }
37     
38     /**
39      * @return
40      */

41     public String JavaDoc getInvoiceNumber()
42     {
43         return invoiceNumber;
44     }
45
46     /**
47      * @return
48      */

49     public String JavaDoc getPurchaser()
50     {
51         return purchaser;
52     }
53
54     /**
55      * @param string
56      */

57     public void setInvoiceNumber(String JavaDoc string)
58     {
59         invoiceNumber = string;
60     }
61
62     /**
63      * @param string
64      */

65     public void setPurchaser(String JavaDoc string)
66     {
67         purchaser = string;
68     }
69
70
71
72     public void addLineItem()
73     {
74         LineItem newItem = new LineItem();
75         newItem.setProduct("New!");
76         
77         lineItems.add(newItem);
78     }
79     public void removeLineItem()
80     {
81         // remove the last item
82
lineItems.remove(lineItems.size() - 1);
83     }
84     /**
85      * @return
86      */

87     public List JavaDoc getLineItems()
88     {
89         return lineItems;
90     }
91
92     /**
93      * @param list
94      */

95     public void setLineItems(List JavaDoc list)
96     {
97         lineItems = list;
98     }
99
100 }
101
Popular Tags