Open Kilda Java Documentation
NetworkCommandData.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.command.discovery;
17 
18 import static com.google.common.base.MoreObjects.toStringHelper;
19 
21 
22 import com.fasterxml.jackson.annotation.JsonCreator;
23 import com.fasterxml.jackson.annotation.JsonInclude;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
26 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
27 
28 import java.util.Objects;
29 
33 @JsonSerialize
34 @JsonInclude(JsonInclude.Include.NON_NULL)
35 @JsonPropertyOrder({
36  "command",
37  "requester"})
38 public class NetworkCommandData extends CommandData {
42  private static final long serialVersionUID = 1L;
43 
47  @JsonProperty("requester")
48  private String requester;
49 
53  public NetworkCommandData() {
54  }
55 
61  @JsonCreator
62  public NetworkCommandData(@JsonProperty("requester") String requester) {
63  this.requester = requester;
64  }
65 
71  public String getRequester() {
72  return requester;
73  }
74 
80  public void setRequester(String requester) {
81  this.requester = requester;
82  }
83 
87  @Override
88  public String toString() {
89  return toStringHelper(this)
90  .add("requester", requester)
91  .toString();
92  }
93 
97  @Override
98  public boolean equals(Object object) {
99  if (this == object) {
100  return true;
101  }
102  if (object == null || getClass() != object.getClass()) {
103  return false;
104  }
105 
106  NetworkCommandData that = (NetworkCommandData) object;
107  return Objects.equals(getRequester(), that.getRequester());
108  }
109 
113  @Override
114  public int hashCode() {
115  return Objects.hash(requester);
116  }
117 }
NetworkCommandData(@JsonProperty("requester") String requester)