View Javadoc

1   package org.apache.commons.digester3.examples.api.addressbook;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   * 
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */ 
19  
20  /**
21   * See Main.java.
22   */
23  public class Address
24  {
25  
26      private String type;
27  
28      private String street;
29  
30      private String city;
31  
32      private String state;
33  
34      private String zip;
35  
36      private String country;
37  
38      @Override
39      public String toString()
40      {
41          StringBuilder sb = new StringBuilder();
42          sb.append( " address (type " + type + ")\n" );
43          sb.append( "       " + street + "\n" );
44          sb.append( "       " + city + " " + state + " " + zip + "\n" );
45          sb.append( "       " + country + "\n" );
46          return sb.toString();
47      }
48  
49      public void print( java.io.PrintStream out, int indentAmount )
50      {
51          StringBuilder indentStr = new StringBuilder( indentAmount );
52          for ( ; indentAmount > 0; --indentAmount )
53          {
54              indentStr.append( ' ' );
55          }
56  
57          out.print( indentStr );
58          out.print( "address type: " );
59          out.println( type );
60  
61          out.print( indentStr );
62          out.println( "  " + street );
63  
64          out.print( indentStr );
65          out.println( "  " + city + " " + state + " " + zip );
66  
67          out.print( indentStr );
68          out.println( "  " + country );
69      }
70  
71      /**
72       * Returns the value of street.
73       */
74      public String getStreet()
75      {
76          return street;
77      }
78  
79      /**
80       * Sets the value of street.
81       * 
82       * @param street The value to assign to street.
83       */
84      public void setStreet( String street )
85      {
86          this.street = street;
87      }
88  
89      /**
90       * Returns the value of city.
91       */
92      public String getCity()
93      {
94          return city;
95      }
96  
97      /**
98       * Sets the value of city.
99       * 
100      * @param city The value to assign to city.
101      */
102     public void setCity( String city )
103     {
104         this.city = city;
105     }
106 
107     /**
108      * Returns the value of state.
109      */
110     public String getState()
111     {
112         return state;
113     }
114 
115     /**
116      * Sets the value of state.
117      * 
118      * @param state The value to assign to state.
119      */
120     public void setState( String state )
121     {
122         this.state = state;
123     }
124 
125     /**
126      * Returns the value of zip.
127      */
128     public String getZip()
129     {
130         return zip;
131     }
132 
133     /**
134      * Sets the value of zip.
135      * 
136      * @param zip The value to assign to zip.
137      */
138     public void setZip( String zip )
139     {
140         this.zip = zip;
141     }
142 
143     /**
144      * Returns the value of country.
145      */
146     public String getCountry()
147     {
148         return country;
149     }
150 
151     /**
152      * Sets the value of country.
153      * 
154      * @param country The value to assign to country.
155      */
156     public void setCountry( String country )
157     {
158         this.country = country;
159     }
160 
161     /**
162      * Returns the value of type.
163      */
164     public String getType()
165     {
166         return type;
167     }
168 
169     /**
170      * Sets the value of type.
171      * 
172      * @param type The value to assign to type.
173      */
174     public void setType( String type )
175     {
176         this.type = type;
177     }
178 
179 }