Fix FindBugs violations
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronMeteringLabelRule.java
1 /*
2  * Copyright (c) 2015 IBM Corporation and others.  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 javax.xml.bind.annotation.XmlAccessType;
12 import javax.xml.bind.annotation.XmlAccessorType;
13 import javax.xml.bind.annotation.XmlElement;
14 import javax.xml.bind.annotation.XmlRootElement;
15
16 @XmlRootElement
17 @XmlAccessorType(XmlAccessType.NONE)
18 public final class NeutronMeteringLabelRule extends NeutronObject<NeutronMeteringLabelRule> {
19     private static final long serialVersionUID = 1L;
20
21     @XmlElement(name = "direction")
22     String meteringLabelRuleDirection;
23
24     @XmlElement(defaultValue = "false", name = "excluded")
25     Boolean meteringLabelRuleExcluded;
26
27     @XmlElement(name = "remote_ip_prefix")
28     String meteringLabelRuleRemoteIpPrefix;
29
30     @XmlElement(name = "metering_label_id")
31     String meteringLabelRuleLabelID;
32
33     /*
34      *  getters and setters
35      */
36
37     public String getMeteringLabelRuleDirection() {
38         return meteringLabelRuleDirection;
39     }
40
41     public void setMeteringLabelRuleDirection(String direction) {
42         this.meteringLabelRuleDirection = direction;
43     }
44
45     public Boolean getMeteringLabelRuleExcluded() {
46         return meteringLabelRuleExcluded;
47     }
48
49     public void setMeteringLabelRuleExcluded(Boolean excluded) {
50         this.meteringLabelRuleExcluded = excluded;
51     }
52
53     public String getMeteringLabelRuleRemoteIpPrefix() {
54         return meteringLabelRuleRemoteIpPrefix;
55     }
56
57     public void setMeteringLabelRuleRemoteIpPrefix(String prefix) {
58         this.meteringLabelRuleRemoteIpPrefix = prefix;
59     }
60
61     public String getMeteringLabelRuleLabelID() {
62         return meteringLabelRuleLabelID;
63     }
64
65     public void setMeteringLabelRuleLabelID(String meteringLabelID) {
66         this.meteringLabelRuleLabelID = meteringLabelID;
67     }
68
69     /*
70      *  constructor
71      */
72     public NeutronMeteringLabelRule() {
73     }
74
75     @Override
76     public String toString() {
77         return "NeutronMeteringLabelRule [id=" + uuid + ", tenantID=" + tenantID + ", direction="
78                 + meteringLabelRuleDirection + ", excluded=" + meteringLabelRuleExcluded + ", remote_ip_prefix="
79                 + meteringLabelRuleRemoteIpPrefix + ", metering_label_id=" + meteringLabelRuleLabelID + "]";
80     }
81
82     @Override
83     protected boolean extractField(String field, NeutronMeteringLabelRule ans) {
84         switch (field) {
85             case "direction":
86                 ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
87                 break;
88             case "excluded":
89                 ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
90                 break;
91             case "remote_ip_prefix":
92                 ans.setMeteringLabelRuleRemoteIpPrefix(this.getMeteringLabelRuleRemoteIpPrefix());
93                 break;
94             case "metering_label_id":
95                 ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());
96                 break;
97             default:
98                 return super.extractField(field, ans);
99         }
100         return true;
101     }
102 }