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