Checkstyle Import issues fix (SPI, Model)
[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 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 NeutronMeteringLabel extends NeutronObject implements Serializable, INeutronObject {
22     private static final long serialVersionUID = 1L;
23
24     @XmlElement (name = "name")
25     String meteringLabelName;
26
27     @XmlElement (defaultValue = "false", name = "shared")
28     Boolean shared;
29
30     /*
31      * getters and setters
32      */
33
34     public String getMeteringLabelName() {
35         return meteringLabelName;
36     }
37
38     public void setMeteringLabelName(String name) {
39         this.meteringLabelName = name;
40     }
41
42     public Boolean getMeteringLabelShared() {
43         return shared;
44     }
45
46     public void setMeteringLabelShared(Boolean shared) {
47         this.shared = shared;
48     }
49
50     /*
51      *  constructor
52      */
53     public NeutronMeteringLabel() { }
54
55     @Override
56     public String toString() {
57         return "NeutronMeteringLabel [id=" + uuid +
58             ", name=" + meteringLabelName +
59             ", tenant_id=" + tenantID +
60             ", shared=" + shared +
61             "]";
62     }
63
64     /**
65      * This method copies selected fields from the object and returns them
66      * as a new object, suitable for marshaling.
67      *
68      * @param fields
69      *            List of attributes to be extracted
70      * @return a NeutronMeteringLabel object with only the selected fields
71      * populated
72      */
73     public NeutronMeteringLabel extractFields(List<String> fields) {
74         NeutronMeteringLabel ans = new NeutronMeteringLabel();
75         Iterator<String> i = fields.iterator();
76         while (i.hasNext()) {
77             String s = i.next();
78             if (s.equals("id")) {
79                 ans.setID(this.getID());
80             }
81             if (s.equals("name")) {
82                 ans.setMeteringLabelName(this.getMeteringLabelName());
83             }
84             if (s.equals("tenant_id")) {
85                 ans.setTenantID(this.getTenantID());
86             }
87             if (s.equals("shared")) {
88                 ans.setMeteringLabelShared(this.getMeteringLabelShared());
89             }
90         }
91         return ans;
92     }
93 }