1 22 package org.jboss.test.jmx.xmbean; 23 24 import java.util.ArrayList ; 25 import java.util.Collection ; 26 27 56 public class User { 57 58 private long id = System.currentTimeMillis(); 59 private int number; 60 private String name = ""; 61 private String address = ""; 62 private String password = null; 63 private Collection numbers = new ArrayList (); 65 66 72 public User(long id) 73 { 74 this.id = id; 75 } 76 77 82 public User() 83 { 84 } 85 86 87 96 public long getID() { 97 return id; 98 } 99 100 101 102 108 public void setID(long id) { 109 this.id = id; 110 } 111 112 113 114 115 125 public int getNumber() 126 { 127 return number; 128 } 129 130 131 137 public void setNumber(int number) 138 { 139 this.number = number; 140 } 141 142 143 144 153 public String getName() { 154 return name; 155 } 156 162 public void setName(String name) { 163 this.name = name; 164 } 165 166 167 168 177 public String getAddress() { 178 return address; 179 } 180 181 187 public void setAddress(String address) { 188 this.address = address; 189 } 190 191 192 193 201 public Collection getPhoneNumbers() { 202 return numbers; 203 } 204 210 public void setPhoneNumbers(Collection numbers) { 211 this.numbers.clear(); 212 this.numbers.addAll(numbers); 213 } 214 215 216 217 225 public void setPassword(String passwd) { 226 this.password = passwd; 227 } 228 229 230 232 238 public String printInfo() { 239 return 240 "User: " + getName() +"\n"+ 241 "Address: " + getAddress() +"\n"+ 242 "Phone numbers: " + numbers; 243 } 244 245 252 public void addPhoneNumber(String number) { 253 numbers.add(number); 254 } 255 256 263 public void removePhoneNumber(String number) { 264 numbers.remove(number); 265 } 266 } 267 268 269 | Popular Tags |