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;
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;
20 @XmlAccessorType(XmlAccessType.NONE)
21 public final class NeutronMeteringLabel extends NeutronObject<NeutronMeteringLabel>
22 implements Serializable, INeutronObject<NeutronMeteringLabel> {
23 private static final long serialVersionUID = 1L;
25 @XmlElement(name = "name")
26 String meteringLabelName;
28 @XmlElement(defaultValue = "false", name = "shared")
35 public String getMeteringLabelName() {
36 return meteringLabelName;
39 public void setMeteringLabelName(String name) {
40 this.meteringLabelName = name;
43 public Boolean getMeteringLabelShared() {
47 public void setMeteringLabelShared(Boolean shared) {
54 public NeutronMeteringLabel() {
58 public String toString() {
59 return "NeutronMeteringLabel [id=" + uuid + ", name=" + meteringLabelName + ", tenant_id=" + tenantID
60 + ", shared=" + shared + "]";
64 * This method copies selected fields from the object and returns them
65 * as a new object, suitable for marshaling.
68 * List of attributes to be extracted
69 * @return a NeutronMeteringLabel object with only the selected fields
72 public NeutronMeteringLabel extractFields(List<String> fields) {
73 NeutronMeteringLabel ans = new NeutronMeteringLabel();
74 Iterator<String> i = fields.iterator();
78 ans.setID(this.getID());
80 if (s.equals("name")) {
81 ans.setMeteringLabelName(this.getMeteringLabelName());
83 if (s.equals("tenant_id")) {
84 ans.setTenantID(this.getTenantID());
86 if (s.equals("shared")) {
87 ans.setMeteringLabelShared(this.getMeteringLabelShared());