X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=neutron-spi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fneutron%2Fspi%2FNeutronL2gateway.java;h=c672c0a3b512628ad30afa285e5205cf2a6d0419;hb=5ea8b0d602de7507f8b7ab445cd08dd860120858;hp=88a6afdaa3a4a640d04716777e33fedb9ca2edfb;hpb=3b49549f18b9c28daeb7777e67b0b0f8ec172c18;p=neutron.git diff --git a/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronL2gateway.java b/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronL2gateway.java index 88a6afdaa..c672c0a3b 100644 --- a/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronL2gateway.java +++ b/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronL2gateway.java @@ -10,65 +10,44 @@ package org.opendaylight.neutron.spi; import java.io.Serializable; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "l2gateway") -public class NeutronL2gateway extends NeutronObject - implements Serializable, INeutronObject { +public final class NeutronL2gateway extends NeutronBaseAttributes + implements Serializable { private static final long serialVersionUID = 1L; - @XmlElement(name = "name") - String l2gatewayName; - @XmlElement(name = "devices") - List neutronL2gatewayDevices; - - public String getL2gatewayName() { - return l2gatewayName; - } - - public void setL2gatewayName(String l2gatewayName) { - this.l2gatewayName = l2gatewayName; - } + List l2gatewayDevices; public List getNeutronL2gatewayDevices() { - return neutronL2gatewayDevices; + return l2gatewayDevices; } - public void setNeutronL2gatewayDevices(List neutronL2gatewayDevices) { - this.neutronL2gatewayDevices = neutronL2gatewayDevices; + public void setNeutronL2gatewayDevices(List l2gatewayDevices) { + this.l2gatewayDevices = l2gatewayDevices; } - public NeutronL2gateway extractFields(List fields) { - NeutronL2gateway ans = new NeutronL2gateway(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - String s = i.next(); - if (s.equals("id")) { - ans.setID(this.getID()); - } - if (s.equals("name")) { - ans.setL2gatewayName(this.getL2gatewayName()); - } - if (s.equals("tenant_id")) { - ans.setTenantID(this.getTenantID()); - } - if (s.equals("devices")) { + @Override + protected boolean extractField(String field, NeutronL2gateway ans) { + switch (field) { + case "devices": List devices = new ArrayList(); devices.addAll(this.getNeutronL2gatewayDevices()); ans.setNeutronL2gatewayDevices(devices); - } + break; + default: + return super.extractField(field, ans); } - return ans; + return true; } @Override public String toString() { - return "NeutronL2Gateway [" + "id = " + uuid + ", name = " + l2gatewayName + ", tenant_id = " + tenantID - + ", devices = " + neutronL2gatewayDevices + "]"; + return "NeutronL2Gateway [" + "id = " + uuid + ", name = " + name + ", tenant_id = " + tenantID + + ", devices = " + l2gatewayDevices + "]"; } }