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<NeutronMeteringLabelRule>
22 implements Serializable, INeutronObject<NeutronMeteringLabelRule> {
23 private static final long serialVersionUID = 1L;
25 @XmlElement(name = "direction")
26 String meteringLabelRuleDirection;
28 @XmlElement(defaultValue = "false", name = "excluded")
29 Boolean meteringLabelRuleExcluded;
31 @XmlElement(name = "remote_ip_prefix")
32 String meteringLabelRuleRemoteIPPrefix;
34 @XmlElement(name = "metering_label_id")
35 String meteringLabelRuleLabelID;
41 public String getMeteringLabelRuleDirection() {
42 return meteringLabelRuleDirection;
45 public void setMeteringLabelRuleDirection(String direction) {
46 this.meteringLabelRuleDirection = direction;
49 public Boolean getMeteringLabelRuleExcluded() {
50 return meteringLabelRuleExcluded;
53 public void setMeteringLabelRuleExcluded(Boolean excluded) {
54 this.meteringLabelRuleExcluded = excluded;
57 public String getMeteringLabelRuleRemoteIPPrefix() {
58 return meteringLabelRuleRemoteIPPrefix;
61 public void setMeteringLabelRuleRemoteIPPrefix(String prefix) {
62 this.meteringLabelRuleRemoteIPPrefix = prefix;
65 public String getMeteringLabelRuleLabelID() {
66 return meteringLabelRuleLabelID;
69 public void setMeteringLabelRuleLabelID(String meteringLabelID) {
70 this.meteringLabelRuleLabelID = meteringLabelID;
76 public NeutronMeteringLabelRule() {
80 public String toString() {
81 return "NeutronMeteringLabelRule [id=" + uuid + ", tenantID=" + tenantID + ", direction="
82 + meteringLabelRuleDirection + ", excluded=" + meteringLabelRuleExcluded + ", remote_ip_prefix="
83 + meteringLabelRuleRemoteIPPrefix + ", metering_label_id=" + meteringLabelRuleLabelID + "]";
87 * This method copies selected fields from the object and returns them
88 * as a new object, suitable for marshaling.
91 * List of attributes to be extracted
92 * @return a NeutronMeteringLabelRule object with only the selected fields
95 public NeutronMeteringLabelRule extractFields(List<String> fields) {
96 NeutronMeteringLabelRule ans = new NeutronMeteringLabelRule();
97 Iterator<String> i = fields.iterator();
100 if (s.equals("id")) {
101 ans.setID(this.getID());
103 if (s.equals("tenant_id")) {
104 ans.setTenantID(this.getTenantID());
106 if (s.equals("direction")) {
107 ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
109 if (s.equals("excluded")) {
110 ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
112 if (s.equals("remote_ip_prefix")) {
113 ans.setMeteringLabelRuleRemoteIPPrefix(this.getMeteringLabelRuleRemoteIPPrefix());
115 if (s.equals("metering_label_id")) {
116 ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());