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