1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jelly.tags.bean;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20
21 /***
22 * A sample bean that we can construct via Jelly tags
23 *
24 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
25 * @version $Revision: 155420 $
26 */
27 public class Order {
28
29 /*** The Log to which logging calls will be made. */
30 private static final Log log = LogFactory.getLog(Order.class);
31
32 private Product product;
33 private int amount;
34 private double price;
35
36 public Order() {
37 }
38
39 public String toString() {
40 return "Order[amount=" + amount + ";price=" + price + ";product=" + product + "]";
41 }
42
43 /***
44 * Factory method to create a new Product
45 public Product createProduct() {
46 return new Product();
47 }
48 */
49
50 public void addProduct(Product product)
51 {
52 this.product = product;
53 }
54
55 /***
56 * Returns the amount.
57 * @return int
58 */
59 public int getAmount() {
60 return amount;
61 }
62
63 /***
64 * Returns the price.
65 * @return double
66 */
67 public double getPrice() {
68 return price;
69 }
70
71 /***
72 * Sets the amount.
73 * @param amount The amount to set
74 */
75 public void setAmount(int amount) {
76 this.amount = amount;
77 }
78
79 /***
80 * Sets the price.
81 * @param price The price to set
82 */
83 public void setPrice(double price) {
84 this.price = price;
85 }
86
87 /***
88 * Returns the product.
89 * @return Product
90 */
91 public Product getProduct() {
92 return product;
93 }
94
95 /***
96 * Sets the product.
97 * @param product The product to set
98 */
99 public void setProduct(Product product) {
100 this.product = product;
101 }
102
103 }