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 implements Serializable, INeutronObject {
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 getID() {
46 return meteringLabelRuleUUID;
49 public void setID(String id) {
50 meteringLabelRuleUUID = id;
53 // @deprecated use getID()
54 public String getMeteringLabelRuleUUID() {
55 return meteringLabelRuleUUID;
58 // @deprecated use setID()
59 public void setMeteringLabelRuleUUID(String uuid) {
60 this.meteringLabelRuleUUID = uuid;
63 public String getMeteringLabelRuleDirection() {
64 return meteringLabelRuleDirection;
67 public void setMeteringLabelRuleDirection(String direction) {
68 this.meteringLabelRuleDirection = direction;
71 public Boolean getMeteringLabelRuleExcluded() {
72 return meteringLabelRuleExcluded;
75 public void setMeteringLabelRuleExcluded(Boolean excluded) {
76 this.meteringLabelRuleExcluded = excluded;
79 public String getMeteringLabelRuleRemoteIPPrefix() {
80 return meteringLabelRuleRemoteIPPrefix;
83 public void setMeteringLabelRuleRemoteIPPrefix(String prefix) {
84 this.meteringLabelRuleRemoteIPPrefix = prefix;
87 public String getMeteringLabelRuleLabelID() {
88 return meteringLabelRuleLabelID;
91 public void setMeteringLabelRuleLabelID(String meteringLabelID) {
92 this.meteringLabelRuleLabelID = meteringLabelID;
98 public NeutronMeteringLabelRule() { }
101 public String toString() {
102 return "NeutronMeteringLabelRule [id=" + meteringLabelRuleUUID +
103 ", direction=" + meteringLabelRuleDirection +
104 ", excluded=" + meteringLabelRuleExcluded +
105 ", remote_ip_prefix=" + meteringLabelRuleRemoteIPPrefix +
106 ", metering_label_id=" + meteringLabelRuleLabelID + "]";
110 * This method copies selected fields from the object and returns them
111 * as a new object, suitable for marshaling.
114 * List of attributes to be extracted
115 * @return a NeutronMeteringLabelRule object with only the selected fields
118 public NeutronMeteringLabelRule extractFields(List<String> fields) {
119 NeutronMeteringLabelRule ans = new NeutronMeteringLabelRule();
120 Iterator<String> i = fields.iterator();
121 while (i.hasNext()) {
123 if (s.equals("id")) {
124 ans.setID(this.getID());
126 if (s.equals("direction")) {
127 ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
129 if (s.equals("excluded")) {
130 ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
132 if (s.equals("remote_ip_prefix")) {
133 ans.setMeteringLabelRuleRemoteIPPrefix(this.getMeteringLabelRuleRemoteIPPrefix());
135 if (s.equals("metering_label_id")) {
136 ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());