Open Kilda Java Documentation
FlowStatsRequest.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.stats;
17 
21 
22 import com.fasterxml.jackson.annotation.JsonCreator;
23 import com.fasterxml.jackson.annotation.JsonInclude;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 
26 @JsonInclude(JsonInclude.Include.NON_NULL)
27 public class FlowStatsRequest extends CommandData {
31  @JsonProperty("switch_id")
32  protected SwitchId flowId;
33 
39  @JsonCreator
40  public FlowStatsRequest(@JsonProperty("switch_id") final SwitchId flowId) {
41  setFlowId(flowId);
42  }
43 
49  public SwitchId getFlowId() {
50  return flowId;
51  }
52 
58  public void setFlowId(SwitchId flowId) {
59  if (flowId == null) {
60  throw new IllegalArgumentException("need to set a switch_id");
61  } else if (!Utils.validateSwitchId(flowId)) {
62  throw new IllegalArgumentException("need to set valid value for switch_id");
63  }
64  this.flowId = flowId;
65  }
66 }
static boolean validateSwitchId(SwitchId switchId)
Definition: Utils.java:144