1 package org.apache.commons.digester3.examples.xmlrules.addressbook;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 import java.io.PrintStream;
21
22
23
24
25 public class Address
26 {
27
28 private String type;
29
30 private String street;
31
32 private String city;
33
34 private String state;
35
36 private String zip;
37
38 private String country;
39
40 @Override
41 public String toString()
42 {
43 StringBuilder sb = new StringBuilder();
44 sb.append( " address (type " + type + ")\n" );
45 sb.append( " " + street + "\n" );
46 sb.append( " " + city + " " + state + " " + zip + "\n" );
47 sb.append( " " + country + "\n" );
48 return sb.toString();
49 }
50
51 public void print( PrintStream out, int indentAmount )
52 {
53 StringBuilder indentStr = new StringBuilder( indentAmount );
54 for ( ; indentAmount > 0; --indentAmount )
55 {
56 indentStr.append( ' ' );
57 }
58
59 out.print( indentStr );
60 out.print( "address type: " );
61 out.println( type );
62
63 out.print( indentStr );
64 out.println( " " + street );
65
66 out.print( indentStr );
67 out.println( " " + city + " " + state + " " + zip );
68
69 out.print( indentStr );
70 out.println( " " + country );
71 }
72
73
74
75
76 public String getStreet()
77 {
78 return street;
79 }
80
81
82
83
84
85
86 public void setStreet( String street )
87 {
88 this.street = street;
89 }
90
91
92
93
94 public String getCity()
95 {
96 return city;
97 }
98
99
100
101
102
103
104 public void setCity( String city )
105 {
106 this.city = city;
107 }
108
109
110
111
112 public String getState()
113 {
114 return state;
115 }
116
117
118
119
120
121
122 public void setState( String state )
123 {
124 this.state = state;
125 }
126
127
128
129
130 public String getZip()
131 {
132 return zip;
133 }
134
135
136
137
138
139
140 public void setZip( String zip )
141 {
142 this.zip = zip;
143 }
144
145
146
147
148 public String getCountry()
149 {
150 return country;
151 }
152
153
154
155
156
157
158 public void setCountry( String country )
159 {
160 this.country = country;
161 }
162
163
164
165
166 public String getType()
167 {
168 return type;
169 }
170
171
172
173
174
175
176 public void setType( String type )
177 {
178 this.type = type;
179 }
180
181 }