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