Fix FindBugs violations
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronL2gateway.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 java.util.ArrayList;
12 import java.util.List;
13 import javax.xml.bind.annotation.XmlElement;
14 import javax.xml.bind.annotation.XmlRootElement;
15
16 @XmlRootElement(name = "l2gateway")
17 public final class NeutronL2gateway extends NeutronBaseAttributes<NeutronL2gateway> {
18     private static final long serialVersionUID = 1L;
19
20     @XmlElement(name = "devices")
21     List<NeutronL2gatewayDevice> l2gatewayDevices;
22
23     public List<NeutronL2gatewayDevice> getNeutronL2gatewayDevices() {
24         return l2gatewayDevices;
25     }
26
27     public void setNeutronL2gatewayDevices(List<NeutronL2gatewayDevice> newL2gatewayDevices) {
28         this.l2gatewayDevices = newL2gatewayDevices;
29     }
30
31     @Override
32     protected boolean extractField(String field, NeutronL2gateway ans) {
33         switch (field) {
34             case "devices":
35                 List<NeutronL2gatewayDevice> devices = new ArrayList<>();
36                 devices.addAll(this.getNeutronL2gatewayDevices());
37                 ans.setNeutronL2gatewayDevices(devices);
38                 break;
39             default:
40                 return super.extractField(field, ans);
41         }
42         return true;
43     }
44
45     @Override
46     public String toString() {
47         return "NeutronL2Gateway [" + "id = " + uuid + ", name = " + name + ", tenant_id = " + tenantID
48                 + ", devices = " + l2gatewayDevices + "]";
49     }
50
51 }