1 16 package org.apache.commons.jelly.core; 17 18 import java.util.ArrayList ; 19 import java.util.Iterator ; 20 import java.util.List ; 21 22 28 public class Customer { 29 30 private String name; 31 private String city; 32 private String location; 33 private List orders = new ArrayList (); 34 35 36 public Customer() { 37 } 38 39 public Customer(String name) { 40 setName(name); 41 } 42 43 public Customer(String name, String city) { 44 setName(name); 45 setCity(city); 46 } 47 48 public Customer(String name, String city, Order anOrder) { 49 setName(name); 50 setCity(city); 51 addOrder(anOrder); 52 } 53 54 public Customer(Customer cust) { 55 setName(cust.getName()); 56 setCity(cust.getCity()); 57 setLocation(cust.getLocation()); 58 List list = cust.getOrders(); 59 if(null != list) { 60 for(Iterator iter = list.iterator();iter.hasNext();) { 61 addOrder((Order)iter.next()); 62 } 63 } 64 } 65 66 public String toString() { 67 return super.toString() + "[name=" + name + ";city=" + city + "]"; 68 } 69 70 73 public Order createOrder() { 74 return new Order(); 75 } 76 77 public List getOrders() { 78 return orders; 79 } 80 81 public void addOrder(Order order) { 82 orders.add(order); 83 } 84 85 public void removeOrder(Order order) { 86 orders.remove(order); 87 } 88 89 93 public String getCity() { 94 return city; 95 } 96 97 101 public String getLocation() { 102 return location; 103 } 104 105 109 public String getName() { 110 return name; 111 } 112 113 117 public void setCity(String city) { 118 this.city = city; 119 } 120 121 125 public void setLocation(String location) { 126 this.location = location; 127 } 128 129 133 public void setName(String name) { 134 this.name = name; 135 } 136 137 138 } 139 | Popular Tags |