2 * Copyright (c) 2015 IBM Corporation and others. All rights reserved.
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
9 package org.opendaylight.neutron.spi;
11 import java.io.Serializable;
13 import java.util.Iterator;
14 import java.util.List;
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;
22 @XmlAccessorType(XmlAccessType.NONE)
23 public class NeutronMeteringLabel implements Serializable, INeutronObject {
24 private static final long serialVersionUID = 1L;
26 @XmlElement (name = "id")
27 String meteringLabelUUID;
29 @XmlElement (name = "name")
30 String meteringLabelName;
32 @XmlElement (name = "tenant_id")
35 @XmlElement (name = "description")
42 public String getID() {
43 return meteringLabelUUID;
46 public void setID(String id) {
47 meteringLabelUUID = id;
50 // @deprecated use getID()
51 public String getMeteringLabelUUID() {
52 return meteringLabelUUID;
55 // @deprecated use setID()
56 public void setMeteringLabelUUID(String uuid) {
57 this.meteringLabelUUID = uuid;
60 public String getMeteringLabelName() {
61 return meteringLabelName;
64 public void setMeteringLabelName(String name) {
65 this.meteringLabelName = name;
68 public String getMeteringLabelTenantID() {
72 public void setMeteringLabelTenantID(String tenantID) {
73 this.tenantID = tenantID;
76 public String getMeteringLabelDescription() {
80 public void setMeteringLabelDescription(String description) {
81 this.description = description;
87 public NeutronMeteringLabel() { }
90 public String toString() {
91 return "NeutronMeteringLabel [id=" + meteringLabelUUID +
92 ", name=" + meteringLabelName +
93 ", description=" + description +
94 ", tenant_id=" + tenantID + "]";
98 * This method copies selected fields from the object and returns them
99 * as a new object, suitable for marshaling.
102 * List of attributes to be extracted
103 * @return a NeutronMeteringLabel object with only the selected fields
106 public NeutronMeteringLabel extractFields(List<String> fields) {
107 NeutronMeteringLabel ans = new NeutronMeteringLabel();
108 Iterator<String> i = fields.iterator();
109 while (i.hasNext()) {
111 if (s.equals("id")) {
112 ans.setID(this.getID());
114 if (s.equals("name")) {
115 ans.setMeteringLabelName(this.getMeteringLabelName());
117 if (s.equals("tenant_id")) {
118 ans.setMeteringLabelTenantID(this.getMeteringLabelTenantID());
120 if (s.equals("description")) {
121 ans.setMeteringLabelDescription(this.getMeteringLabelDescription());