1 4 5 package com.sun.j2ee.blueprints.docoriented.client; 6 7 import org.w3c.dom.*; 8 9 public class Address { 10 11 private String street; 12 private String city; 13 private String state; 14 private String postalCode; 15 16 public Address() {} 17 18 public Address(String street, String city, 19 String state, String postalCode) { 20 this.street = street; 21 this.city = city; 22 this.state = state; 23 this.postalCode = postalCode; 24 return; 25 } 26 27 public String getStreet() { 29 return street; 30 } 31 32 public String getCity() { 33 return city; 34 } 35 36 public String getState() { 37 return state; 38 } 39 40 public String getPostalCode() { 41 return postalCode; 42 } 43 44 public void setStreet(String street) { 46 this.street = street; 47 return; 48 } 49 50 public void setCity(String city) { 51 this.city = city; 52 return; 53 } 54 55 public void setState(String state) { 56 this.state = state; 57 return; 58 } 59 60 public void setPostalCode(String postalCode) { 61 this.postalCode = postalCode; 62 return; 63 } 64 65 public Node toDOM(Document doc, Element addrElem) { 66 Element elem = doc.createElement("street"); 67 elem.appendChild(doc.createTextNode(street)); 68 addrElem.appendChild(elem); 69 elem = doc.createElement("city"); 70 elem.appendChild(doc.createTextNode(city)); 71 addrElem.appendChild(elem); 72 elem = doc.createElement("state"); 73 elem.appendChild(doc.createTextNode(state)); 74 addrElem.appendChild(elem); 75 elem = doc.createElement("postalCode"); 76 elem.appendChild(doc.createTextNode(postalCode)); 77 addrElem.appendChild(elem); 78 return addrElem; 79 } 80 } 81 82 83 84 85 86 | Popular Tags |