Open Kilda Java Documentation
MeterDelete.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.model.rule;
17 
18 import com.fasterxml.jackson.annotation.JsonProperty;
19 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
20 import com.google.common.base.MoreObjects;
21 
22 import java.io.Serializable;
23 import java.util.Objects;
24 
28 @JsonSerialize
29 public class MeterDelete extends Rule implements Serializable {
33  private static final long serialVersionUID = 1L;
34 
38  @JsonProperty(RuleConstants.METER_ID)
39  protected int meterId;
40 
44  public MeterDelete() {
45  }
46 
55  public MeterDelete(@JsonProperty(RuleConstants.FLOW_ID) String flowId,
56  @JsonProperty(RuleConstants.COOKIE) int cookie,
57  @JsonProperty(RuleConstants.SWITCH_ID) String switchId,
58  @JsonProperty(RuleConstants.METER_ID) int meterId) {
59  super(flowId, cookie, switchId);
60  this.meterId = meterId;
61  }
62 
68  public int getMeterId() {
69  return meterId;
70  }
71 
77  public void setMeterId(int meterId) {
78  this.meterId = meterId;
79  }
80 
84  @Override
85  public boolean equals(Object object) {
86  if (this == object) {
87  return true;
88  }
89  if (object == null || getClass() != object.getClass()) {
90  return false;
91  }
92 
93  MeterDelete that = (MeterDelete) object;
94  return Objects.equals(getFlowId(), that.getFlowId())
95  && getCookie() == that.getCookie()
96  && Objects.equals(getSwitchId(), that.getSwitchId())
97  && getMeterId() == that.getMeterId();
98  }
99 
103  @Override
104  public int hashCode() {
105  return Objects.hash(getFlowId(), getCookie(), getSwitchId(), getMeterId());
106  }
107 
111  @Override
112  public String toString() {
113  return MoreObjects.toStringHelper(this)
118  .toString();
119  }
120 }
MeterDelete(@JsonProperty(RuleConstants.FLOW_ID) String flowId, @JsonProperty(RuleConstants.COOKIE) int cookie, @JsonProperty(RuleConstants.SWITCH_ID) String switchId, @JsonProperty(RuleConstants.METER_ID) int meterId)