1 package net.sf.aspect4log.manual;
2
3 import java.math.BigDecimal;
4 import java.util.Arrays;
5
6 public class Order {
7
8 private int id;
9 private Customer customer;
10 private String address;
11 private Item[] items;
12
13 public Order(Customer customer, String address, Item[] items) {
14 this.customer = customer;
15
16 this.address = address;
17 this.items = items;
18 }
19
20 public Customer getCustomer() {
21 return customer;
22 }
23
24 public String getAddress() {
25 return address;
26 }
27
28 public Item[] getItems() {
29 return items;
30 }
31
32 public BigDecimal getPrice(){
33 BigDecimal result = BigDecimal.ZERO;
34 for (Item item : items){
35 result=result.add(item.getPrice());
36 }
37 return result;
38 }
39
40 public int getId() {
41 return id;
42 }
43
44 public void setId(int id) {
45 this.id = id;
46 }
47
48 @Override
49 public String toString() {
50 return "Order [id=" + id + ", customer=" + customer + ", address=" + address + ", items=" + Arrays.toString(items) + "]";
51 }
52
53 }