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.xml1;
18  
19  import java.util.Objects;
20  import jakarta.xml.bind.annotation.XmlRootElement;
21  import jakarta.xml.bind.annotation.XmlType;
22  
23  /**
24   * The person.
25   *
26   * @author Christian Bremer
27   */
28  @XmlRootElement(name = "person")
29  @XmlType(name = "personType")
30  @SuppressWarnings("unused")
31  public class Person {
32  
33    private String firstName;
34  
35    private String lastName;
36  
37    /**
38     * Gets first name.
39     *
40     * @return the first name
41     */
42    public String getFirstName() {
43      return firstName;
44    }
45  
46    /**
47     * Sets first name.
48     *
49     * @param firstName the first name
50     */
51    public void setFirstName(String firstName) {
52      this.firstName = firstName;
53    }
54  
55    /**
56     * Gets last name.
57     *
58     * @return the last name
59     */
60    public String getLastName() {
61      return lastName;
62    }
63  
64    /**
65     * Sets last name.
66     *
67     * @param lastName the last name
68     */
69    public void setLastName(String lastName) {
70      this.lastName = lastName;
71    }
72  
73    @Override
74    public String toString() {
75      return "Person{"
76          + "firstName='" + firstName + '\''
77          + ", lastName='" + lastName + '\''
78          + '}';
79    }
80  
81    @Override
82    public boolean equals(Object o) {
83      if (this == o) {
84        return true;
85      }
86      if (!(o instanceof Person)) {
87        return false;
88      }
89      Person person = (Person) o;
90      return Objects.equals(firstName, person.firstName)
91          && Objects.equals(lastName, person.lastName);
92    }
93  
94    @Override
95    public int hashCode() {
96      return Objects.hash(firstName, lastName);
97    }
98  }