checkstyle: enable JavadocTagContinuationIndentation
[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 java.io.Serializable;
12 import java.util.List;
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 NeutronMeteringLabelRule extends NeutronObject<NeutronMeteringLabelRule>
21         implements Serializable, INeutronObject<NeutronMeteringLabelRule> {
22     private static final long serialVersionUID = 1L;
23
24     @XmlElement(name = "direction")
25     String meteringLabelRuleDirection;
26
27     @XmlElement(defaultValue = "false", name = "excluded")
28     Boolean meteringLabelRuleExcluded;
29
30     @XmlElement(name = "remote_ip_prefix")
31     String meteringLabelRuleRemoteIPPrefix;
32
33     @XmlElement(name = "metering_label_id")
34     String meteringLabelRuleLabelID;
35
36     /*
37      *  getters and setters
38      */
39
40     public String getMeteringLabelRuleDirection() {
41         return meteringLabelRuleDirection;
42     }
43
44     public void setMeteringLabelRuleDirection(String direction) {
45         this.meteringLabelRuleDirection = direction;
46     }
47
48     public Boolean getMeteringLabelRuleExcluded() {
49         return meteringLabelRuleExcluded;
50     }
51
52     public void setMeteringLabelRuleExcluded(Boolean excluded) {
53         this.meteringLabelRuleExcluded = excluded;
54     }
55
56     public String getMeteringLabelRuleRemoteIPPrefix() {
57         return meteringLabelRuleRemoteIPPrefix;
58     }
59
60     public void setMeteringLabelRuleRemoteIPPrefix(String prefix) {
61         this.meteringLabelRuleRemoteIPPrefix = prefix;
62     }
63
64     public String getMeteringLabelRuleLabelID() {
65         return meteringLabelRuleLabelID;
66     }
67
68     public void setMeteringLabelRuleLabelID(String meteringLabelID) {
69         this.meteringLabelRuleLabelID = meteringLabelID;
70     }
71
72     /*
73      *  constructor
74      */
75     public NeutronMeteringLabelRule() {
76     }
77
78     @Override
79     public String toString() {
80         return "NeutronMeteringLabelRule [id=" + uuid + ", tenantID=" + tenantID + ", direction="
81                 + meteringLabelRuleDirection + ", excluded=" + meteringLabelRuleExcluded + ", remote_ip_prefix="
82                 + meteringLabelRuleRemoteIPPrefix + ", metering_label_id=" + meteringLabelRuleLabelID + "]";
83     }
84
85     /**
86      * This method copies selected fields from the object and returns them
87      * as a new object, suitable for marshaling.
88      *
89      * @param fields
90      *            List of attributes to be extracted
91      * @return a NeutronMeteringLabelRule object with only the selected fields
92      *             populated
93      */
94     public NeutronMeteringLabelRule extractFields(List<String> fields) {
95         NeutronMeteringLabelRule ans = new NeutronMeteringLabelRule();
96         for (String s : fields) {
97             extractField(s, ans);
98             if (s.equals("direction")) {
99                 ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
100             }
101             if (s.equals("excluded")) {
102                 ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
103             }
104             if (s.equals("remote_ip_prefix")) {
105                 ans.setMeteringLabelRuleRemoteIPPrefix(this.getMeteringLabelRuleRemoteIPPrefix());
106             }
107             if (s.equals("metering_label_id")) {
108                 ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());
109             }
110         }
111         return ans;
112     }
113 }