Checkstyle Import issues fix (SPI, Model)
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronSFCPortPairGroup.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.neutron.spi;
9
10 import java.io.Serializable;
11 import java.util.Iterator;
12 import java.util.List;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
17
18 @XmlRootElement
19 @XmlAccessorType(XmlAccessType.NONE)
20
21 public class NeutronSFCPortPairGroup extends NeutronObject implements Serializable, INeutronObject {
22     private static final long serialVersionUID = 1L;
23
24     // See OpenStack Networking SFC (networking-sfc) Port Pair Group API v1.0
25     // Reference for description of annotated attributes
26
27     @XmlElement(name = "name")
28     String name;
29
30     @XmlElement(name = "port_pairs")
31     List<String> portPairs;
32
33     public NeutronSFCPortPairGroup() {
34     }
35
36     public String getName() {
37         return name;
38     }
39
40     public void setName(String name) {
41         this.name = name;
42     }
43
44     public List<String> getPortPairs() {
45         return portPairs;
46     }
47
48     public void setPortPairs(List<String> portPairs) {
49         this.portPairs = portPairs;
50     }
51
52     /**
53      * This method copies selected fields from the object and returns them
54      * as a new object, suitable for marshaling.
55      *
56      * @param fields List of attributes to be extracted
57      * @return an OpenStack Neutron SFC Port Pair Group object with only the selected fields
58      * populated
59      */
60
61     public NeutronSFCPortPairGroup extractFields(List<String> fields) {
62         NeutronSFCPortPairGroup ans = new NeutronSFCPortPairGroup();
63         Iterator<String> i = fields.iterator();
64         while (i.hasNext()) {
65             String s = i.next();
66             if (s.equals("id")) {
67                 ans.setID(this.getID());
68             }
69             if (s.equals("tenant_id")) {
70                 ans.setTenantID(this.getTenantID());
71             }
72             if (s.equals("name")) {
73                 ans.setName(this.getName());
74             }
75             if (s.equals("port_pairs")) {
76                 ans.setPortPairs(this.getPortPairs());
77             }
78         }
79         return ans;
80     }
81
82     @Override
83     public String toString() {
84         return "NeutronSFCPortPairGroup[" +
85                 "tenantID='" + tenantID + '\'' +
86                 ", name='" + name + '\'' +
87                 ", portPairs=" + portPairs +
88                 ']';
89     }
90 }