Open Kilda Java Documentation
SwitchInfoData.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.messaging.info.event;
17 
18 import static com.google.common.base.MoreObjects.toStringHelper;
19 
22 
23 import com.fasterxml.jackson.annotation.JsonCreator;
24 import com.fasterxml.jackson.annotation.JsonInclude;
25 import com.fasterxml.jackson.annotation.JsonProperty;
26 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
27 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
28 
29 import java.util.Objects;
30 
37 @JsonSerialize
38 @JsonInclude(JsonInclude.Include.NON_NULL)
39 @JsonPropertyOrder({
40  "switch_id",
41  "state",
42  "address",
43  "hostname",
44  "description",
45  "controller"})
46 public class SwitchInfoData extends CacheTimeTag {
50  private static final long serialVersionUID = 1L;
51 
55  @JsonProperty("switch_id")
56  private SwitchId switchId;
57 
61  @JsonProperty("address")
62  private String address;
63 
67  @JsonProperty("hostname")
68  private String hostname;
69 
73  @JsonProperty("description")
74  private String description;
75 
79  @JsonProperty("state")
80  private SwitchState state;
81 
85  @JsonProperty("controller")
86  private String controller;
87 
91  public SwitchInfoData() {
92  }
93 
104  @JsonCreator
105  public SwitchInfoData(@JsonProperty("switch_id") final SwitchId switchId,
106  @JsonProperty("state") final SwitchState state,
107  @JsonProperty("address") final String address,
108  @JsonProperty("hostname") final String hostname,
109  @JsonProperty("description") final String description,
110  @JsonProperty("controller") final String controller) {
111  this.switchId = switchId;
112  this.state = state;
113  this.address = address;
114  this.hostname = hostname;
115  this.description = description;
116  this.controller = controller;
117  }
118 
125  return switchId;
126  }
127 
133  public void setSwitchId(final SwitchId switchId) {
134  this.switchId = switchId;
135  }
136 
143  return state;
144  }
145 
151  public void setState(final SwitchState state) {
152  this.state = state;
153  }
154 
160  public String getAddress() {
161  return address;
162  }
163 
169  public void setAddress(String address) {
170  this.address = address;
171  }
172 
178  public String getHostname() {
179  return hostname;
180  }
181 
187  public void setHostname(String hostname) {
188  this.hostname = hostname;
189  }
190 
196  public String getDescription() {
197  return description;
198  }
199 
205  public void setDescription(String description) {
206  this.description = description;
207  }
208 
214  public String getController() {
215  return controller;
216  }
217 
223  public void setController(String controller) {
224  this.controller = controller;
225  }
226 
230  @Override
231  public String toString() {
232  return toStringHelper(this)
233  .add("switch_id", switchId)
234  .add("state", state)
235  .add("address", address)
236  .add("hostname", hostname)
237  .add("description", description)
238  .add("controller", controller)
239  .toString();
240  }
241 
245  @Override
246  public int hashCode() {
247  return Objects.hash(switchId, state, address, hostname, description, controller);
248  }
249 
253  @Override
254  public boolean equals(Object object) {
255  if (this == object) {
256  return true;
257  }
258  if (object == null || getClass() != object.getClass()) {
259  return false;
260  }
261 
262  SwitchInfoData that = (SwitchInfoData) object;
263  return Objects.equals(getSwitchId(), that.getSwitchId())
264  && Objects.equals(getState(), that.getState())
265  && Objects.equals(getAddress(), that.getAddress())
266  && Objects.equals(getHostname(), that.getHostname())
267  && Objects.equals(getDescription(), that.getDescription())
268  && Objects.equals(getController(), that.getController());
269  }
270 }
description
Definition: setup.py:26
SwitchInfoData(@JsonProperty("switch_id") final SwitchId switchId, @JsonProperty("state") final SwitchState state, @JsonProperty("address") final String address, @JsonProperty("hostname") final String hostname, @JsonProperty("description") final String description, @JsonProperty("controller") final String controller)