Open Kilda Java Documentation
FlowDelete.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 FlowDelete extends Rule implements Serializable {
33  private static final long serialVersionUID = 1L;
34 
38  @JsonProperty(RuleConstants.MATCH_PORT)
39  protected int matchPort;
40 
44  @JsonProperty(RuleConstants.MATCH_VLAN)
45  protected int matchVlan;
46 
50  public FlowDelete() {
51  }
52 
62  public FlowDelete(@JsonProperty(RuleConstants.FLOW_ID) String flowId,
63  @JsonProperty(RuleConstants.COOKIE) int cookie,
64  @JsonProperty(RuleConstants.SWITCH_ID) String switchId,
65  @JsonProperty(RuleConstants.MATCH_PORT) int matchPort,
66  @JsonProperty(RuleConstants.MATCH_VLAN) int matchVlan) {
67  super(flowId, cookie, switchId);
68  this.matchPort = matchPort;
69  this.matchVlan = matchVlan;
70  }
71 
77  public int getMatchPort() {
78  return matchPort;
79  }
80 
86  public void setMatchPort(int matchPort) {
87  this.matchPort = matchPort;
88  }
89 
95  public int getMatchVlan() {
96  return matchVlan;
97  }
98 
104  public void setMatchVlan(int matchVlan) {
105  this.matchVlan = matchVlan;
106  }
107 
111  @Override
112  public boolean equals(Object object) {
113  if (this == object) {
114  return true;
115  }
116 
117  if (object == null || getClass() != object.getClass()) {
118  return false;
119  }
120 
121  FlowDelete that = (FlowDelete) object;
122  return Objects.equals(getFlowId(), that.getFlowId())
123  && getCookie() == that.getCookie()
124  && Objects.equals(getSwitchId(), that.getSwitchId())
125  && getMatchPort() == that.getMatchPort()
126  && getMatchVlan() == that.getMatchVlan();
127  }
128 
132  @Override
133  public int hashCode() {
134  return Objects.hash(getFlowId(), getCookie(), getSwitchId(), getMatchPort(), getMatchVlan());
135  }
136 
140  @Override
141  public String toString() {
142  return MoreObjects.toStringHelper(this)
148  .toString();
149  }
150 }
FlowDelete(@JsonProperty(RuleConstants.FLOW_ID) String flowId, @JsonProperty(RuleConstants.COOKIE) int cookie, @JsonProperty(RuleConstants.SWITCH_ID) String switchId, @JsonProperty(RuleConstants.MATCH_PORT) int matchPort, @JsonProperty(RuleConstants.MATCH_VLAN) int matchVlan)
Definition: FlowDelete.java:62