Fix FindBugs violations
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronRouter.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 java.util.List;
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
18 @XmlAccessorType(XmlAccessType.NONE)
19 public final class NeutronRouter extends NeutronAdminAttributes<NeutronRouter> {
20     private static final long serialVersionUID = 1L;
21
22     // See OpenStack Network API v2.0 Reference for description of
23     // annotated attributes
24     @XmlElement(name = "external_gateway_info", nillable = true)
25     NeutronRouterNetworkReference externalGatewayInfo;
26
27     @XmlElement(name = "distributed")
28     Boolean distributed;
29
30     @XmlElement(name = "gw_port_id", nillable = true)
31     String gatewayPortId;
32
33     @XmlElement(name = "routes")
34     List<NeutronRoute> routes;
35
36     public NeutronRouter() {
37     }
38
39     public NeutronRouterNetworkReference getExternalGatewayInfo() {
40         return externalGatewayInfo;
41     }
42
43     public void setExternalGatewayInfo(NeutronRouterNetworkReference externalGatewayInfo) {
44         this.externalGatewayInfo = externalGatewayInfo;
45     }
46
47     public Boolean getDistributed() {
48         return distributed;
49     }
50
51     public void setDistributed(Boolean distributed) {
52         this.distributed = distributed;
53     }
54
55     public String getGatewayPortId() {
56         return gatewayPortId;
57     }
58
59     public void setGatewayPortId(String gatewayPortId) {
60         this.gatewayPortId = gatewayPortId;
61     }
62
63     public List<NeutronRoute> getRoutes() {
64         return routes;
65     }
66
67     public void setRoutes(List<NeutronRoute> routes) {
68         this.routes = routes;
69     }
70
71     @Override
72     protected boolean extractField(String field, NeutronRouter ans) {
73         switch (field) {
74             case "external_gateway_info":
75                 ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
76                 break;
77             case "distributed":
78                 ans.setDistributed(this.getDistributed());
79                 break;
80             case "gw_port_id":
81                 ans.setGatewayPortId(this.getGatewayPortId());
82                 break;
83             case "routes":
84                 ans.setRoutes(this.getRoutes());
85                 break;
86             default:
87                 return super.extractField(field, ans);
88         }
89         return true;
90     }
91
92     @Override
93     public String toString() {
94         return "NeutronRouter [" + "id=" + uuid + ", name=" + name + ", adminStateUp=" + adminStateUp + ", status="
95                 + status + ", tenantID=" + tenantID + ", external_gateway_info=" + externalGatewayInfo
96                 + ", distributed=" + distributed + ", gw_port_id=" + gatewayPortId + ", routes=" + routes + "]";
97     }
98
99 }