Open Kilda Java Documentation
MeterConfigStatsRequest.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 MeterConfigStatsRequest extends CommandData {
31  @JsonProperty("switch_id")
32  protected SwitchId switchId;
33 
39  @JsonCreator
40  public MeterConfigStatsRequest(@JsonProperty("switch_id") final SwitchId switchId) {
41  setSwitchId(switchId);
42  }
43 
49  public SwitchId getSwitchId() {
50  return switchId;
51  }
52 
58  public void setSwitchId(SwitchId switchId) {
59  if (switchId == null) {
60  throw new IllegalArgumentException("need to set a switch_id");
61  } else if (!Utils.validateSwitchId(switchId)) {
62  throw new IllegalArgumentException("need to set valid value for switch_id");
63  }
64  this.switchId = switchId;
65  }
66 }
static boolean validateSwitchId(SwitchId switchId)
Definition: Utils.java:144