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 class NeutronMeteringLabelRule extends NeutronObject implements Serializable, INeutronObject {
22 private static final long serialVersionUID = 1L;
24 @XmlElement(name = "direction")
25 String meteringLabelRuleDirection;
27 @XmlElement(defaultValue = "false", name = "excluded")
28 Boolean meteringLabelRuleExcluded;
30 @XmlElement(name = "remote_ip_prefix")
31 String meteringLabelRuleRemoteIPPrefix;
33 @XmlElement(name = "metering_label_id")
34 String meteringLabelRuleLabelID;
40 public String getMeteringLabelRuleDirection() {
41 return meteringLabelRuleDirection;
44 public void setMeteringLabelRuleDirection(String direction) {
45 this.meteringLabelRuleDirection = direction;
48 public Boolean getMeteringLabelRuleExcluded() {
49 return meteringLabelRuleExcluded;
52 public void setMeteringLabelRuleExcluded(Boolean excluded) {
53 this.meteringLabelRuleExcluded = excluded;
56 public String getMeteringLabelRuleRemoteIPPrefix() {
57 return meteringLabelRuleRemoteIPPrefix;
60 public void setMeteringLabelRuleRemoteIPPrefix(String prefix) {
61 this.meteringLabelRuleRemoteIPPrefix = prefix;
64 public String getMeteringLabelRuleLabelID() {
65 return meteringLabelRuleLabelID;
68 public void setMeteringLabelRuleLabelID(String meteringLabelID) {
69 this.meteringLabelRuleLabelID = meteringLabelID;
75 public NeutronMeteringLabelRule() {
79 public String toString() {
80 return "NeutronMeteringLabelRule [id=" + uuid + ", tenantID=" + tenantID + ", direction="
81 + meteringLabelRuleDirection + ", excluded=" + meteringLabelRuleExcluded + ", remote_ip_prefix="
82 + meteringLabelRuleRemoteIPPrefix + ", metering_label_id=" + meteringLabelRuleLabelID + "]";
86 * This method copies selected fields from the object and returns them
87 * as a new object, suitable for marshaling.
90 * List of attributes to be extracted
91 * @return a NeutronMeteringLabelRule object with only the selected fields
94 public NeutronMeteringLabelRule extractFields(List<String> fields) {
95 NeutronMeteringLabelRule ans = new NeutronMeteringLabelRule();
96 Iterator<String> i = fields.iterator();
100 ans.setID(this.getID());
102 if (s.equals("tenant_id")) {
103 ans.setTenantID(this.getTenantID());
105 if (s.equals("direction")) {
106 ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
108 if (s.equals("excluded")) {
109 ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
111 if (s.equals("remote_ip_prefix")) {
112 ans.setMeteringLabelRuleRemoteIPPrefix(this.getMeteringLabelRuleRemoteIPPrefix());
114 if (s.equals("metering_label_id")) {
115 ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());