View Javadoc

1   /* $Id: Address.java 1102402 2011-05-12 18:03:26Z simonetripodi $
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one or more
4    * contributor license agreements.  See the NOTICE file distributed with
5    * this work for additional information regarding copyright ownership.
6    * The ASF licenses this file to You under the Apache License, Version 2.0
7    * (the "License"); you may not use this file except in compliance with
8    * the License.  You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.apache.commons.digester3;
20  
21  /**
22   * Bean for Digester testing.
23   */
24  
25  public class Address
26  {
27  
28      public Address()
29      {
30          this( "My Street", "My City", "US", "MyZip" );
31      }
32  
33      public Address( String street, String city, String state, String zipCode )
34      {
35          super();
36          setStreet( street );
37          setCity( city );
38          setState( state );
39          setZipCode( zipCode );
40      }
41  
42      private String city = null;
43  
44      public String getCity()
45      {
46          return ( this.city );
47      }
48  
49      public void setCity( String city )
50      {
51          this.city = city;
52      }
53  
54      private String state = null;
55  
56      public String getState()
57      {
58          return ( this.state );
59      }
60  
61      public void setState( String state )
62      {
63          this.state = state;
64      }
65  
66      private String street = null;
67  
68      public String getStreet()
69      {
70          return ( this.street );
71      }
72  
73      public void setStreet( String street )
74      {
75          this.street = street;
76      }
77  
78      private String type = null;
79  
80      public String getType()
81      {
82          return ( this.type );
83      }
84  
85      public void setType( String type )
86      {
87          this.type = type;
88      }
89  
90      private String zipCode = null;
91  
92      public String getZipCode()
93      {
94          return ( this.zipCode );
95      }
96  
97      public void setZipCode( String zipCode )
98      {
99          this.zipCode = zipCode;
100     }
101 
102     public void setEmployee( Employee employee )
103     {
104         employee.addAddress( this );
105     }
106 
107     @Override
108     public String toString()
109     {
110         StringBuilder sb = new StringBuilder( "Address[" );
111         sb.append( "street=" );
112         sb.append( street );
113         sb.append( ", city=" );
114         sb.append( city );
115         sb.append( ", state=" );
116         sb.append( state );
117         sb.append( ", zipCode=" );
118         sb.append( zipCode );
119         sb.append( "]" );
120         return ( sb.toString() );
121     }
122 
123 }