Fix FindBugs violations
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronL2gatewayConnection.java
1 /*
2  * Copyright (c) 2015 Hewlett-Packard Development Company, L.P. 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
9 package org.opendaylight.neutron.spi;
10
11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 @XmlRootElement(name = "l2gatewayConnection")
18 @XmlAccessorType(XmlAccessType.NONE)
19 public final class NeutronL2gatewayConnection extends NeutronBaseAttributes<NeutronL2gatewayConnection> {
20     private static final long serialVersionUID = 1L;
21
22     @XmlElement(name = "gateway_id")
23     String l2gatewayID;
24
25     @XmlElement(name = "network_id")
26     String networkID;
27
28     @XmlElement(name = "segmentation_id")
29     Integer segmentID;
30
31     @XmlElement(name = "port_id")
32     String portID;
33
34     public String getL2gatewayID() {
35         return l2gatewayID;
36     }
37
38     public String getNetworkID() {
39         return networkID;
40     }
41
42     public Integer getSegmentID() {
43         return segmentID;
44     }
45
46     public void setL2gatewayID(String l2gatewayID) {
47         this.l2gatewayID = l2gatewayID;
48     }
49
50     public void setNetworkID(String networkID) {
51         this.networkID = networkID;
52     }
53
54     public void setSegmentID(Integer segmentID) {
55         this.segmentID = segmentID;
56     }
57
58     // getPortID differ only by capitalization with NeutronTrunk.getPortId but it's not worth changing the API and
59     // disrupting downstream users just for that reason.
60     @SuppressFBWarnings("NM_CONFUSING")
61     public String getPortID() {
62         return portID;
63     }
64
65     @SuppressFBWarnings("NM_CONFUSING")
66     public void setPortID(String portID) {
67         this.portID = portID;
68     }
69
70     @Override
71     protected boolean extractField(String field, NeutronL2gatewayConnection ans) {
72         switch (field) {
73             case "connection_id":
74                 ans.setID(this.getID());
75                 break;
76             case "gateway_id":
77                 ans.setL2gatewayID(this.getL2gatewayID());
78                 break;
79             case "network_id":
80                 ans.setNetworkID(this.getNetworkID());
81                 break;
82             case "segmentation_id":
83                 ans.setSegmentID(this.getSegmentID());
84                 break;
85             case "port_id":
86                 ans.setPortID(this.getPortID());
87                 break;
88             default:
89                 return super.extractField(field, ans);
90         }
91         return true;
92     }
93
94     @Override
95     public String toString() {
96         return "NeutronL2GatewayConnection [" + "tenant_id = " + tenantID + ", connection_id = " + uuid
97                 + ", gateway_id = " + l2gatewayID + ", network_id = " + networkID + ", segmentation_id = " + segmentID
98                 + ", port_id = " + portID + "]";
99     }
100
101 }