Fix FindBugs violations
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronRouterInterface.java
1 /*
2  * Copyright (c) 2013, 2015 IBM Corporation 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 javax.xml.bind.annotation.XmlAccessType;
12 import javax.xml.bind.annotation.XmlAccessorType;
13 import javax.xml.bind.annotation.XmlElement;
14 import javax.xml.bind.annotation.XmlRootElement;
15
16 @XmlRootElement
17 @XmlAccessorType(XmlAccessType.NONE)
18 public final class NeutronRouterInterface extends NeutronObject<NeutronRouterInterface> {
19     private static final long serialVersionUID = 1L;
20
21     // See OpenStack Network API v2.0 Reference for description of
22     // annotated attributes
23
24     @XmlElement(name = "subnet_id")
25     String subnetUUID;
26
27     @XmlElement(name = "port_id")
28     String portUUID;
29
30     public NeutronRouterInterface() {
31     }
32
33     public NeutronRouterInterface(String subnetUUID, String portUUID) {
34         this.subnetUUID = subnetUUID;
35         this.portUUID = portUUID;
36     }
37
38     public String getSubnetUUID() {
39         return subnetUUID;
40     }
41
42     public void setSubnetUUID(String subnetUUID) {
43         this.subnetUUID = subnetUUID;
44     }
45
46     public String getPortUUID() {
47         return portUUID;
48     }
49
50     public void setPortUUID(String portUUID) {
51         this.portUUID = portUUID;
52     }
53
54     @Override
55     protected boolean extractField(String field, NeutronRouterInterface ans) {
56         switch (field) {
57             case "subnet_id":
58                 ans.setSubnetUUID(this.getSubnetUUID());
59                 break;
60             case "port_id":
61                 ans.setPortUUID(this.getPortUUID());
62                 break;
63             default:
64                 return super.extractField(field, ans);
65         }
66         return true;
67     }
68
69     @Override
70     public String toString() {
71         return "NeutronRouterInterface [" + "subnetUUID=" + subnetUUID + ", portUUID=" + portUUID + ", id=" + uuid
72                 + ", tenantID=" + tenantID + "]";
73     }
74 }