1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
28
29
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
44
45
46
47 public String getBrand() {
48 return brand;
49 }
50
51
52
53
54
55
56 public void setBrand(String brand) {
57 this.brand = brand;
58 }
59
60
61
62
63
64
65 public String getModel() {
66 return model;
67 }
68
69
70
71
72
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 }