View Javadoc
1   /*
2    * Copyright 2020 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.ArrayList;
20  import java.util.List;
21  import java.util.Objects;
22  import jakarta.xml.bind.annotation.XmlAccessType;
23  import jakarta.xml.bind.annotation.XmlAccessorType;
24  import jakarta.xml.bind.annotation.XmlAttribute;
25  import jakarta.xml.bind.annotation.XmlElement;
26  import jakarta.xml.bind.annotation.XmlElementWrapper;
27  import jakarta.xml.bind.annotation.XmlRootElement;
28  import jakarta.xml.bind.annotation.XmlType;
29  
30  /**
31   * The vehicles.
32   *
33   * @author Christian Bremer
34   */
35  @XmlRootElement(name = "vehicles")
36  @XmlType(name = "vehiclesType")
37  @XmlAccessorType(XmlAccessType.FIELD)
38  public class Vehicles {
39  
40    @XmlAttribute(required = true)
41    private String series;
42  
43    @XmlAttribute(required = true)
44    private int year;
45  
46    @XmlElement(defaultValue = "0")
47    private Integer month;
48  
49    @XmlElementWrapper(name = "list")
50    @XmlElement(name = "vehicle")
51    private List<Vehicle> entries = new ArrayList<>();
52  
53    /**
54     * Gets series.
55     *
56     * @return the series
57     */
58    @SuppressWarnings("unused")
59    public String getSeries() {
60      return series;
61    }
62  
63    /**
64     * Sets series.
65     *
66     * @param series the series
67     */
68    public void setSeries(String series) {
69      this.series = series;
70    }
71  
72    /**
73     * Gets year.
74     *
75     * @return the year
76     */
77    @SuppressWarnings("unused")
78    public int getYear() {
79      return year;
80    }
81  
82    /**
83     * Sets year.
84     *
85     * @param year the year
86     */
87    public void setYear(int year) {
88      this.year = year;
89    }
90  
91    /**
92     * Gets month.
93     *
94     * @return the month
95     */
96    @SuppressWarnings("unused")
97    public Integer getMonth() {
98      return month;
99    }
100 
101   /**
102    * Sets month.
103    *
104    * @param month the month
105    */
106   public void setMonth(Integer month) {
107     this.month = month;
108   }
109 
110   /**
111    * Gets entries.
112    *
113    * @return the entries
114    */
115   public List<Vehicle> getEntries() {
116     return entries;
117   }
118 
119   @Override
120   public boolean equals(Object o) {
121     if (this == o) {
122       return true;
123     }
124     if (o == null || getClass() != o.getClass()) {
125       return false;
126     }
127     Vehicles vehicles = (Vehicles) o;
128     return year == vehicles.year
129         && Objects.equals(series, vehicles.series)
130         && Objects.equals(month, vehicles.month)
131         && Objects.equals(entries, vehicles.entries);
132   }
133 
134   @Override
135   public int hashCode() {
136     return Objects.hash(series, year, month, entries);
137   }
138 
139   @Override
140   public String toString() {
141     return "Vehicles{"
142         + "series='" + series + '\''
143         + ", year=" + year
144         + ", month=" + month
145         + '}';
146   }
147 }