View Javadoc
1   /*
2    * Copyright 2019 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.bremersee.xml.test.model.xml4;
18  
19  import java.util.Objects;
20  import jakarta.xml.bind.annotation.XmlRootElement;
21  import jakarta.xml.bind.annotation.XmlType;
22  
23  /**
24   * The address.
25   *
26   * @author Christian Bremer
27   */
28  @XmlRootElement(name = "address")
29  @XmlType(name = "addressType")
30  @SuppressWarnings("unused")
31  public class Address {
32  
33    private String street;
34  
35    private String streetNumber;
36  
37    /**
38     * Gets street.
39     *
40     * @return the street
41     */
42    public String getStreet() {
43      return street;
44    }
45  
46    /**
47     * Sets street.
48     *
49     * @param street the street
50     */
51    public void setStreet(String street) {
52      this.street = street;
53    }
54  
55    /**
56     * Gets street number.
57     *
58     * @return the street number
59     */
60    public String getStreetNumber() {
61      return streetNumber;
62    }
63  
64    /**
65     * Sets street number.
66     *
67     * @param streetNumber the street number
68     */
69    public void setStreetNumber(String streetNumber) {
70      this.streetNumber = streetNumber;
71    }
72  
73    @Override
74    public String toString() {
75      return "Address{"
76          + "street='" + street + '\''
77          + ", streetNumber='" + streetNumber + '\''
78          + '}';
79    }
80  
81    @Override
82    public boolean equals(Object o) {
83      if (this == o) {
84        return true;
85      }
86      if (!(o instanceof Address)) {
87        return false;
88      }
89      Address address = (Address) o;
90      return Objects.equals(street, address.street)
91          && Objects.equals(streetNumber, address.streetNumber);
92    }
93  
94    @Override
95    public int hashCode() {
96      return Objects.hash(street, streetNumber);
97    }
98  }