2 * Copyright IBM Corporation, 2015. 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 implements Serializable {
24 private static final long serialVersionUID = 1L;
26 @XmlElement (name = "id")
27 String meteringLabelRuleUUID;
29 @XmlElement (name = "direction")
30 String meteringLabelRuleDirection;
32 @XmlElement (defaultValue = "false", name = "excluded")
33 Boolean meteringLabelRuleExcluded;
35 @XmlElement (name = "remote_ip_prefix")
36 String meteringLabelRuleRemoteIPPrefix;
38 @XmlElement (name = "metering_label_id")
39 String meteringLabelRuleLabelID;
45 public String getMeteringLabelRuleUUID() {
46 return meteringLabelRuleUUID;
49 public void setMeteringLabelRuleUUID(String uuid) {
50 this.meteringLabelRuleUUID = uuid;
53 public String getMeteringLabelRuleDirection() {
54 return meteringLabelRuleDirection;
57 public void setMeteringLabelRuleDirection(String direction) {
58 this.meteringLabelRuleDirection = direction;
61 public Boolean getMeteringLabelRuleExcluded() {
62 return meteringLabelRuleExcluded;
65 public void setMeteringLabelRuleExcluded(Boolean excluded) {
66 this.meteringLabelRuleExcluded = excluded;
69 public String getMeteringLabelRuleRemoteIPPrefix() {
70 return meteringLabelRuleRemoteIPPrefix;
73 public void setMeteringLabelRuleRemoteIPPrefix(String prefix) {
74 this.meteringLabelRuleRemoteIPPrefix = prefix;
77 public String getMeteringLabelRuleLabelID() {
78 return meteringLabelRuleLabelID;
81 public void setMeteringLabelRuleLabelID(String meteringLabelID) {
82 this.meteringLabelRuleLabelID = meteringLabelID;
88 public NeutronMeteringLabelRule() { }
91 public String toString() {
92 return "NeutronMeteringLabelRule [id=" + meteringLabelRuleUUID +
93 ", direction=" + meteringLabelRuleDirection +
94 ", excluded=" + meteringLabelRuleExcluded +
95 ", remote_ip_prefix=" + meteringLabelRuleRemoteIPPrefix +
96 ", metering_label_id=" + meteringLabelRuleLabelID + "]";
100 * This method copies selected fields from the object and returns them
101 * as a new object, suitable for marshaling.
104 * List of attributes to be extracted
105 * @return a NeutronMeteringLabelRule object with only the selected fields
108 public NeutronMeteringLabelRule extractFields(List<String> fields) {
109 NeutronMeteringLabelRule ans = new NeutronMeteringLabelRule();
110 Iterator<String> i = fields.iterator();
111 while (i.hasNext()) {
113 if (s.equals("id")) {
114 ans.setMeteringLabelRuleUUID(this.getMeteringLabelRuleUUID());
116 if (s.equals("direction")) {
117 ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
119 if (s.equals("excluded")) {
120 ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
122 if (s.equals("remote_ip_prefix")) {
123 ans.setMeteringLabelRuleRemoteIPPrefix(this.getMeteringLabelRuleRemoteIPPrefix());
125 if (s.equals("metering_label_id")) {
126 ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());