52c4a1e9f866797d8d05cf9f94d6337e04a1b847
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronQosBandwidthLimitRule.java
1 /*
2  * Copyright (c) 2016, 2017 Intel Corporation.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.neutron.spi;
10
11 import java.math.BigInteger;
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 @XmlRootElement
18 @XmlAccessorType(XmlAccessType.NONE)
19 public final class NeutronQosBandwidthLimitRule extends NeutronObject<NeutronQosBandwidthLimitRule> {
20     private static final long serialVersionUID = 1L;
21
22     @XmlElement(name = "max_kbps")
23     BigInteger maxKbps;
24
25     @XmlElement(name = "max_burst_kbps")
26     BigInteger maxBurstKbps;
27
28     public BigInteger getMaxKbps() {
29         return maxKbps;
30     }
31
32     public void setMaxKbps(BigInteger maxKbps) {
33         this.maxKbps = maxKbps;
34     }
35
36     public BigInteger getMaxBurstKbps() {
37         return maxBurstKbps;
38     }
39
40     public void setMaxBurstKbps(BigInteger maxBurstKbps) {
41         this.maxBurstKbps = maxBurstKbps;
42     }
43
44     @Override
45     public boolean extractField(String field, NeutronQosBandwidthLimitRule ans) {
46         switch (field) {
47             case "max_kbps":
48                 ans.setMaxKbps(this.getMaxKbps());
49                 break;
50             case "max_burst_kbps":
51                 ans.setMaxBurstKbps(this.getMaxBurstKbps());
52                 break;
53             default:
54                 return super.extractField(field, ans);
55         }
56         return true;
57     }
58
59     @Override
60     public String toString() {
61         return "qosBandwidthLimitRules{" + "qosBandwidthLimitRuleUUID='" + uuid + '\''
62             + ", qosBandwidthLimitRuleTenantID='" + tenantID + '\'' + ", qosBandwidthLimitRuleMaxValue='" + maxKbps
63             + '\'' + ", qosBandwidthLimitRuleMaxBurst='" + maxBurstKbps
64             + '\''
65             + '}';
66     }
67 }