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 NeutronMeteringLabelRule extends NeutronObject implements Serializable, INeutronObject {
24 private static final long serialVersionUID = 1L;
26 @XmlElement (name = "direction")
27 String meteringLabelRuleDirection;
29 @XmlElement (defaultValue = "false", name = "excluded")
30 Boolean meteringLabelRuleExcluded;
32 @XmlElement (name = "remote_ip_prefix")
33 String meteringLabelRuleRemoteIPPrefix;
35 @XmlElement (name = "metering_label_id")
36 String meteringLabelRuleLabelID;
42 // @deprecated use getID()
43 public String getMeteringLabelRuleUUID() {
47 // @deprecated use setID()
48 public void setMeteringLabelRuleUUID(String uuid) {
52 public String getMeteringLabelRuleDirection() {
53 return meteringLabelRuleDirection;
56 public void setMeteringLabelRuleDirection(String direction) {
57 this.meteringLabelRuleDirection = direction;
60 public Boolean getMeteringLabelRuleExcluded() {
61 return meteringLabelRuleExcluded;
64 public void setMeteringLabelRuleExcluded(Boolean excluded) {
65 this.meteringLabelRuleExcluded = excluded;
68 public String getMeteringLabelRuleRemoteIPPrefix() {
69 return meteringLabelRuleRemoteIPPrefix;
72 public void setMeteringLabelRuleRemoteIPPrefix(String prefix) {
73 this.meteringLabelRuleRemoteIPPrefix = prefix;
76 public String getMeteringLabelRuleLabelID() {
77 return meteringLabelRuleLabelID;
80 public void setMeteringLabelRuleLabelID(String meteringLabelID) {
81 this.meteringLabelRuleLabelID = meteringLabelID;
87 public NeutronMeteringLabelRule() { }
90 public String toString() {
91 return "NeutronMeteringLabelRule [id=" + uuid +
92 ", direction=" + meteringLabelRuleDirection +
93 ", excluded=" + meteringLabelRuleExcluded +
94 ", remote_ip_prefix=" + meteringLabelRuleRemoteIPPrefix +
95 ", metering_label_id=" + meteringLabelRuleLabelID + "]";
99 * This method copies selected fields from the object and returns them
100 * as a new object, suitable for marshaling.
103 * List of attributes to be extracted
104 * @return a NeutronMeteringLabelRule object with only the selected fields
107 public NeutronMeteringLabelRule extractFields(List<String> fields) {
108 NeutronMeteringLabelRule ans = new NeutronMeteringLabelRule();
109 Iterator<String> i = fields.iterator();
110 while (i.hasNext()) {
112 if (s.equals("id")) {
113 ans.setID(this.getID());
115 if (s.equals("direction")) {
116 ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
118 if (s.equals("excluded")) {
119 ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
121 if (s.equals("remote_ip_prefix")) {
122 ans.setMeteringLabelRuleRemoteIPPrefix(this.getMeteringLabelRuleRemoteIPPrefix());
124 if (s.equals("metering_label_id")) {
125 ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());