Open Kilda Java Documentation
FlowCacheSyncResponse.java
Go to the documentation of this file.
1 /* Copyright 2018 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.flow;
17 
18 import com.fasterxml.jackson.annotation.JsonCreator;
19 import com.fasterxml.jackson.annotation.JsonInclude;
20 import com.fasterxml.jackson.annotation.JsonProperty;
21 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
22 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
27 
28 import java.util.List;
29 import java.util.Objects;
30 
31 import static com.google.common.base.MoreObjects.toStringHelper;
32 
36 @JsonSerialize
37 @JsonInclude(JsonInclude.Include.NON_NULL)
38 public class FlowCacheSyncResponse extends InfoData {
42  private static final long serialVersionUID = 1L;
43 
47  @JsonProperty(Utils.PAYLOAD)
48  protected FlowCacheSyncResults payload;
49 
56  @JsonCreator
57  public FlowCacheSyncResponse(@JsonProperty(Utils.PAYLOAD) FlowCacheSyncResults payload) {
58  setPayload(payload);
59  }
60 
67  return payload;
68  }
69 
75  public void setPayload(FlowCacheSyncResults payload) {
76  if (payload == null) {
77  throw new IllegalArgumentException("need to set payload");
78  }
79  this.payload = payload;
80  }
81 
85  @Override
86  public String toString() {
87  return toStringHelper(this)
88  .add(Utils.PAYLOAD, payload)
89  .toString();
90  }
91 
95  @Override
96  public int hashCode() {
97  return Objects.hash(payload);
98  }
99 
103  @Override
104  public boolean equals(Object object) {
105  if (this == object) {
106  return true;
107  }
108  if (object == null || getClass() != object.getClass()) {
109  return false;
110  }
111 
113  return Objects.equals(getPayload(), that.getPayload());
114  }
115 }
static final String PAYLOAD
Definition: Utils.java:57