Open Kilda Java Documentation
NetworkInfoData.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.discovery;
17 
18 import static com.google.common.base.MoreObjects.toStringHelper;
19 
26 
27 import com.fasterxml.jackson.annotation.JsonCreator;
28 import com.fasterxml.jackson.annotation.JsonInclude;
29 import com.fasterxml.jackson.annotation.JsonProperty;
30 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
31 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
32 
33 import java.util.Objects;
34 import java.util.Set;
35 
39 @JsonSerialize
40 @JsonInclude(JsonInclude.Include.NON_NULL)
41 @JsonPropertyOrder({
42  "message_type",
43  "requester",
44  "switches",
45  "isls",
46  "flows"})
47 public class NetworkInfoData extends InfoData {
51  private static final long serialVersionUID = 1L;
52 
56  @JsonProperty("requester")
57  protected String requester;
58 
62  @JsonProperty("switches")
63  private Set<SwitchInfoData> switches;
64 
68  @JsonProperty("ports")
69  private Set<PortInfoData> ports;
70 
74  @JsonProperty("isls")
75  private Set<IslInfoData> isls;
76 
80  @JsonProperty("flows")
81  private Set<ImmutablePair<Flow, Flow>> flows;
82 
86  public NetworkInfoData() {
87  }
88 
97  @JsonCreator
98  public NetworkInfoData(@JsonProperty("requester") String requester,
99  @JsonProperty("switches") Set<SwitchInfoData> switches,
100  @JsonProperty("ports") Set<PortInfoData> ports,
101  @JsonProperty("isls") Set<IslInfoData> isls,
102  @JsonProperty("flows") Set<ImmutablePair<Flow, Flow>> flows) {
103  this.requester = requester;
104  this.switches = switches;
105  this.ports = ports;
106  this.isls = isls;
107  this.flows = flows;
108  }
109 
115  public String getRequester() {
116  return requester;
117  }
118 
124  public void setRequester(String requester) {
125  this.requester = requester;
126  }
127 
133  public Set<SwitchInfoData> getSwitches() {
134  return switches;
135  }
136 
142  public void setSwitches(Set<SwitchInfoData> switches) {
143  this.switches = switches;
144  }
145 
151  public Set<PortInfoData> getPorts() {
152  return ports;
153  }
154 
160  public void setPorts(Set<PortInfoData> ports) {
161  this.ports = ports;
162  }
163 
164 
170  public Set<IslInfoData> getIsls() {
171  return isls;
172  }
173 
179  public void setIsls(Set<IslInfoData> isls) {
180  this.isls = isls;
181  }
182 
188  public Set<ImmutablePair<Flow, Flow>> getFlows() {
189  return flows;
190  }
191 
197  public void setFlows(Set<ImmutablePair<Flow, Flow>> flows) {
198  this.flows = flows;
199  }
200 
204  @Override
205  public String toString() {
206  return toStringHelper(this)
207  .add("requester", requester)
208  .add("switches", switches)
209  .add("ports", ports)
210  .add("isls", isls)
211  .add("flows", flows)
212  .toString();
213  }
214 
218  @Override
219  public int hashCode() {
220  return Objects.hash(requester, switches, ports, isls, flows);
221  }
222 
226  @Override
227  public boolean equals(Object object) {
228  if (this == object) {
229  return true;
230  }
231  if (object == null || getClass() != object.getClass()) {
232  return false;
233  }
234 
235  NetworkInfoData that = (NetworkInfoData) object;
236  return Objects.equals(getRequester(), that.getRequester())
237  && Objects.equals(getSwitches(), that.getSwitches())
238  && Objects.equals(getPorts(), that.getPorts())
239  && Objects.equals(getIsls(), that.getIsls())
240  && Objects.equals(getFlows(), that.getFlows());
241  }
242 }
void setSwitches(Set< SwitchInfoData > switches)
void setFlows(Set< ImmutablePair< Flow, Flow >> flows)
NetworkInfoData(@JsonProperty("requester") String requester, @JsonProperty("switches") Set< SwitchInfoData > switches, @JsonProperty("ports") Set< PortInfoData > ports, @JsonProperty("isls") Set< IslInfoData > isls, @JsonProperty("flows") Set< ImmutablePair< Flow, Flow >> flows)