bbc64df5761cc5a5135c37c599882cfd24165fe1
[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.io.Serializable;
12 import java.math.BigInteger;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
17
18 @XmlRootElement
19 @XmlAccessorType(XmlAccessType.NONE)
20 public final class NeutronQosBandwidthLimitRule extends NeutronObject<NeutronQosBandwidthLimitRule>
21         implements Serializable, INeutronObject<NeutronQosBandwidthLimitRule> {
22     private static final long serialVersionUID = 1L;
23
24     @XmlElement(name = "max_kbps")
25     BigInteger maxKbps;
26
27     @XmlElement(name = "max_burst_kbps")
28     BigInteger maxBurstKbps;
29
30     public BigInteger getMaxKbps() {
31         return maxKbps;
32     }
33
34     public void setMaxKbps(BigInteger maxKbps) {
35         this.maxKbps = maxKbps;
36     }
37
38     public BigInteger getMaxBurstKbps() {
39         return maxBurstKbps;
40     }
41
42     public void setMaxBurstKbps(BigInteger maxBurstKbps) {
43         this.maxBurstKbps = maxBurstKbps;
44     }
45
46     @Override
47     public boolean extractField(String field, NeutronQosBandwidthLimitRule ans) {
48         switch (field) {
49             case "max_kbps":
50                 ans.setMaxKbps(this.getMaxKbps());
51                 break;
52             case "max_burst_kbps":
53                 ans.setMaxBurstKbps(this.getMaxBurstKbps());
54                 break;
55             default:
56                 return super.extractField(field, ans);
57         }
58         return true;
59     }
60
61     @Override
62     public String toString() {
63         return "qosBandwidthLimitRules{" + "qosBandwidthLimitRuleUUID='" + uuid + '\''
64             + ", qosBandwidthLimitRuleTenantID='" + tenantID + '\'' + ", qosBandwidthLimitRuleMaxValue='" + maxKbps
65             + '\'' + ", qosBandwidthLimitRuleMaxBurst='" + maxBurstKbps
66             + '\''
67             + '}';
68     }
69 }