1889fba4c9a5bc28014f268aa9a8176da9fd4d20
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronMeteringLabel.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
13 import java.util.Iterator;
14 import java.util.List;
15
16 import javax.xml.bind.annotation.XmlAccessType;
17 import javax.xml.bind.annotation.XmlAccessorType;
18 import javax.xml.bind.annotation.XmlElement;
19 import javax.xml.bind.annotation.XmlRootElement;
20
21 @XmlRootElement
22 @XmlAccessorType(XmlAccessType.NONE)
23 public class NeutronMeteringLabel extends NeutronObject implements Serializable, INeutronObject {
24     private static final long serialVersionUID = 1L;
25
26     @XmlElement (name = "name")
27     String meteringLabelName;
28
29     @XmlElement (name = "description")
30     String description;
31
32     /*
33      * getters and setters
34      */
35
36     // @deprecated use getID()
37     public String getMeteringLabelUUID() {
38         return getID();
39     }
40
41     // @deprecated use setID()
42     public void setMeteringLabelUUID(String uuid) {
43         setID(uuid);
44     }
45
46     public String getMeteringLabelName() {
47         return meteringLabelName;
48     }
49
50     public void setMeteringLabelName(String name) {
51         this.meteringLabelName = name;
52     }
53
54     @Deprecated
55     public String getMeteringLabelTenantID() {
56         return getTenantID();
57     }
58
59     @Deprecated
60     public void setMeteringLabelTenantID(String tenantID) {
61         setTenantID(tenantID);
62     }
63
64     public String getMeteringLabelDescription() {
65         return description;
66     }
67
68     public void setMeteringLabelDescription(String description) {
69         this.description = description;
70     }
71
72     /*
73      *  constructor
74      */
75     public NeutronMeteringLabel() { }
76
77     @Override
78     public String toString() {
79         return "NeutronMeteringLabel [id=" + uuid +
80             ", name=" + meteringLabelName +
81             ", description=" + description +
82             ", tenant_id=" + tenantID + "]";
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 NeutronMeteringLabel object with only the selected fields
92      * populated
93      */
94     public NeutronMeteringLabel extractFields(List<String> fields) {
95         NeutronMeteringLabel ans = new NeutronMeteringLabel();
96         Iterator<String> i = fields.iterator();
97         while (i.hasNext()) {
98             String s = i.next();
99             if (s.equals("id")) {
100                 ans.setID(this.getID());
101             }
102             if (s.equals("name")) {
103                 ans.setMeteringLabelName(this.getMeteringLabelName());
104             }
105             if (s.equals("tenant_id")) {
106                 ans.setTenantID(this.getTenantID());
107             }
108             if (s.equals("description")) {
109                 ans.setMeteringLabelDescription(this.getMeteringLabelDescription());
110             }
111         }
112         return ans;
113     }
114 }