KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > j2ee > blueprints > docoriented > client > Address


1 /* Copyright 2005 Sun Microsystems, Inc. All rights reserved. You may not modify, use, reproduce, or distribute this software except in compliance with the terms of the License at:
2  http://developer.sun.com/berkeley_license.html
3  $Id: Address.java,v 1.9 2005/08/12 19:43:02 smitha Exp $ */

4
5 package com.sun.j2ee.blueprints.docoriented.client;
6
7 import org.w3c.dom.*;
8
9 public class Address {
10
11   private String JavaDoc street;
12   private String JavaDoc city;
13   private String JavaDoc state;
14   private String JavaDoc postalCode;
15
16   public Address() {}
17
18   public Address(String JavaDoc street, String JavaDoc city,
19                  String JavaDoc state, String JavaDoc postalCode) {
20     this.street = street;
21     this.city = city;
22     this.state = state;
23     this.postalCode = postalCode;
24     return;
25   }
26
27   // getter methods
28
public String JavaDoc getStreet() {
29     return street;
30   }
31
32   public String JavaDoc getCity() {
33     return city;
34   }
35
36   public String JavaDoc getState() {
37     return state;
38   }
39
40   public String JavaDoc getPostalCode() {
41     return postalCode;
42   }
43
44   // setter methods
45
public void setStreet(String JavaDoc street) {
46     this.street = street;
47     return;
48   }
49
50   public void setCity(String JavaDoc city) {
51     this.city = city;
52     return;
53   }
54
55   public void setState(String JavaDoc state) {
56     this.state = state;
57     return;
58   }
59
60   public void setPostalCode(String JavaDoc 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