neutron spi: consolidate extractFields() method 27/57927/3
authorIsaku Yamahata <isaku.yamahata@intel.com>
Fri, 26 May 2017 23:27:11 +0000 (16:27 -0700)
committermatcauf <mcauffiez@inocybe.ca>
Mon, 29 May 2017 15:53:58 +0000 (11:53 -0400)
Change-Id: Ibe9479b88004865724a5fa443f49a5297b541369
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
34 files changed:
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronBgpvpn.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronFirewall.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronFirewallPolicy.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronFirewallRule.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronFloatingIp.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronL2gateway.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronL2gatewayConnection.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancer.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerHealthMonitor.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerListener.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerPool.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerPoolMember.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronMeteringLabel.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronMeteringLabelRule.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronNetwork.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronObject.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronPort.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronQosBandwidthRule.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronQosDscpMarkingRule.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronQosPolicy.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronRouter.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronRouterInterface.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSFCFlowClassifier.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSFCPortChain.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSFCPortPair.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSFCPortPairGroup.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSecurityGroup.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSecurityRule.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSubnet.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronTrunk.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronVpnIkePolicy.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronVpnIpSecPolicy.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronVpnIpSecSiteConnection.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronVpnService.java

index 28057dda2bbae8f74d0dbfdb9e90aaf2df038f47..dd7a57a46c05c1c1d644c20eec036c7f8c9cd126 100644 (file)
@@ -14,13 +14,10 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement(name = "bgpvpn")
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronBgpvpn extends NeutronAdminAttributes<NeutronBgpvpn> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronBgpvpn.class);
     // See OpenStack Network API v2.0 Reference for description of
     // annotated attributes
 
@@ -209,59 +206,43 @@ public final class NeutronBgpvpn extends NeutronAdminAttributes<NeutronBgpvpn> i
         routers.remove(uuid);
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return an OpenStackNetworks object with only the selected fields
-     *             populated
-     */
-
-    public NeutronBgpvpn extractFields(List<String> fields) {
-        NeutronBgpvpn ans = new NeutronBgpvpn();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "type":
-                    ans.setType(this.getType());
-                    break;
-                case "technique":
-                    ans.setTechnique(this.getTechnique());
-                    break;
-                case "route_targets":
-                    ans.setRouteTargets(this.getRouteTargets());
-                    break;
-                case "import_targets":
-                    ans.setImportTargets(this.getImportTargets());
-                    break;
-                case "export_targets":
-                    ans.setExportTargets(this.getExportTargets());
-                    break;
-                case "route_distinguishe":
-                    ans.setRouteDistinguishers(this.getRouteDistinguishers());
-                    break;
-                case "routers":
-                    ans.setRouters(this.getRouters());
-                    break;
-                case "networks":
-                    ans.setNetworks(this.getNetworks());
-                    break;
-                case "vnid":
-                    ans.setVnid(this.getVnid());
-                    break;
-                case "auto_aggregate":
-                    ans.setAutoAggregate(this.getAutoAggregate());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronBgpvpn suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronBgpvpn ans) {
+        switch (field) {
+            case "type":
+                ans.setType(this.getType());
+                break;
+            case "technique":
+                ans.setTechnique(this.getTechnique());
+                break;
+            case "route_targets":
+                ans.setRouteTargets(this.getRouteTargets());
+                break;
+            case "import_targets":
+                ans.setImportTargets(this.getImportTargets());
+                break;
+            case "export_targets":
+                ans.setExportTargets(this.getExportTargets());
+                break;
+            case "route_distinguishe":
+                ans.setRouteDistinguishers(this.getRouteDistinguishers());
+                break;
+            case "routers":
+                ans.setRouters(this.getRouters());
+                break;
+            case "networks":
+                ans.setNetworks(this.getNetworks());
+                break;
+            case "vnid":
+                ans.setVnid(this.getVnid());
+                break;
+            case "auto_aggregate":
+                ans.setAutoAggregate(this.getAutoAggregate());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 8ab85b7229812eb5750e49542973fac7b4727b98..ca384d596d00cb7ddc9497baaf12010c2c569d49 100644 (file)
@@ -9,13 +9,10 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Firewall as a service
@@ -37,7 +34,6 @@ import org.slf4j.LoggerFactory;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronFirewall extends NeutronBaseAttributes<NeutronFirewall> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronFirewall.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(defaultValue = "true", name = "admin_state_up")
@@ -73,28 +69,22 @@ public final class NeutronFirewall extends NeutronBaseAttributes<NeutronFirewall
         this.firewallPolicyID = firewallPolicy;
     }
 
-    public NeutronFirewall extractFields(List<String> fields) {
-        NeutronFirewall ans = new NeutronFirewall();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "admin_state_up":
-                    ans.setFirewallAdminStateIsUp(firewallAdminStateIsUp);
-                    break;
-                case "shared":
-                    ans.setFirewallIsShared(firewallIsShared);
-                    break;
-                case "firewall_policy_id":
-                    ans.setFirewallPolicyID(this.getFirewallPolicyID());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronBgpvpn suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronFirewall ans) {
+        switch (field) {
+            case "admin_state_up":
+                ans.setFirewallAdminStateIsUp(firewallAdminStateIsUp);
+                break;
+            case "shared":
+                ans.setFirewallIsShared(firewallIsShared);
+                break;
+            case "firewall_policy_id":
+                ans.setFirewallPolicyID(this.getFirewallPolicyID());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 8d81e9f62535f209b4745272987defbd4919eea2..5e9cfb969fa3f408c6723a23659a96b47546c0da 100644 (file)
@@ -9,13 +9,10 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Firewall as a service
@@ -36,7 +33,6 @@ import org.slf4j.LoggerFactory;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronFirewallPolicy extends NeutronBaseAttributes<NeutronFirewallPolicy> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronFirewallPolicy.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(defaultValue = "false", name = "shared")
@@ -61,25 +57,19 @@ public final class NeutronFirewallPolicy extends NeutronBaseAttributes<NeutronFi
         this.firewallPolicyIsShared = firewallPolicyIsShared;
     }
 
-    public NeutronFirewallPolicy extractFields(List<String> fields) {
-        NeutronFirewallPolicy ans = new NeutronFirewallPolicy();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "shared":
-                    ans.setFirewallPolicyIsShared(firewallPolicyIsShared);
-                    break;
-                case "audited":
-                    ans.setFirewallPolicyIsAudited(firewallPolicyIsAudited);
-                    break;
-                default:
-                    LOGGER.warn("{} is not an NeutronFirewallPolicy suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronFirewallPolicy ans) {
+        switch (field) {
+            case "shared":
+                ans.setFirewallPolicyIsShared(firewallPolicyIsShared);
+                break;
+            case "audited":
+                ans.setFirewallPolicyIsAudited(firewallPolicyIsAudited);
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 8802bfc0aaab7bfdd1628d7ecb8843195c1fa1cf..3fe580b3a81998ea20e260920e67168440f839e5 100644 (file)
@@ -9,13 +9,10 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Firewall as a service
@@ -48,8 +45,6 @@ import org.slf4j.LoggerFactory;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronFirewallRule extends NeutronBaseAttributes<NeutronFirewallRule> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronFirewallRule.class);
-
     private static final long serialVersionUID = 1L;
 
     @XmlElement(defaultValue = "false", name = "shared")
@@ -195,55 +190,49 @@ public final class NeutronFirewallRule extends NeutronBaseAttributes<NeutronFire
         this.firewallRuleIsShared = firewallRuleIsShared;
     }
 
-    public NeutronFirewallRule extractFields(List<String> fields) {
-        NeutronFirewallRule ans = new NeutronFirewallRule();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "shared":
-                    ans.setFirewallRuleIsShared(firewallRuleIsShared);
-                    break;
-                case "firewall_policy_id":
-                    ans.setFirewallRulePolicyID(this.getFirewallRulePolicyID());
-                    break;
-                case "protocol":
-                    ans.setFirewallRuleProtocol(this.getFirewallRuleProtocol());
-                    break;
-                case "source_ip_address":
-                    ans.setFirewallRuleSrcIpAddr(this.getFirewallRuleSrcIpAddr());
-                    break;
-                case "destination_ip_address":
-                    ans.setFirewallRuleDstIpAddr(this.getFirewallRuleDstIpAddr());
-                    break;
-                case "source_port_range_min":
-                    ans.setFirewallRuleSrcPortRangeMin(this.getFirewallRuleSrcPortRangeMin());
-                    break;
-                case "source_port_range_max":
-                    ans.setFirewallRuleSrcPortRangeMax(this.getFirewallRuleSrcPortRangeMax());
-                    break;
-                case "destination_port_range_min":
-                    ans.setFirewallRuleDstPortRangeMin(this.getFirewallRuleDstPortRangeMin());
-                    break;
-                case "destination_port_range_max":
-                    ans.setFirewallRuleDstPortRangeMax(this.getFirewallRuleDstPortRangeMax());
-                    break;
-                case "position":
-                    ans.setFirewallRulePosition(this.getFirewallRulePosition());
-                    break;
-                case "action":
-                    ans.setFirewallRuleAction(this.getFirewallRuleAction());
-                    break;
-                case "enabled":
-                    ans.setFirewallRuleIsEnabled(firewallRuleIsEnabled);
-                    break;
-                default:
-                    LOGGER.warn("Unknown firewall rule {}.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronFirewallRule ans) {
+        switch (field) {
+            case "shared":
+                ans.setFirewallRuleIsShared(firewallRuleIsShared);
+                break;
+            case "firewall_policy_id":
+                ans.setFirewallRulePolicyID(this.getFirewallRulePolicyID());
+                break;
+            case "protocol":
+                ans.setFirewallRuleProtocol(this.getFirewallRuleProtocol());
+                break;
+            case "source_ip_address":
+                ans.setFirewallRuleSrcIpAddr(this.getFirewallRuleSrcIpAddr());
+                break;
+            case "destination_ip_address":
+                ans.setFirewallRuleDstIpAddr(this.getFirewallRuleDstIpAddr());
+                break;
+            case "source_port_range_min":
+                ans.setFirewallRuleSrcPortRangeMin(this.getFirewallRuleSrcPortRangeMin());
+                break;
+            case "source_port_range_max":
+                ans.setFirewallRuleSrcPortRangeMax(this.getFirewallRuleSrcPortRangeMax());
+                break;
+            case "destination_port_range_min":
+                ans.setFirewallRuleDstPortRangeMin(this.getFirewallRuleDstPortRangeMin());
+                break;
+            case "destination_port_range_max":
+                ans.setFirewallRuleDstPortRangeMax(this.getFirewallRuleDstPortRangeMax());
+                break;
+            case "position":
+                ans.setFirewallRulePosition(this.getFirewallRulePosition());
+                break;
+            case "action":
+                ans.setFirewallRuleAction(this.getFirewallRuleAction());
+                break;
+            case "enabled":
+                ans.setFirewallRuleIsEnabled(firewallRuleIsEnabled);
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index a846c8b39c2b5de04db61b603b9e778ef4df4255..cff693525db7a38f1d28fa88338387bc49cdef2b 100644 (file)
@@ -9,19 +9,15 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronFloatingIp
         extends NeutronObject<NeutronFloatingIp> implements Serializable, INeutronObject<NeutronFloatingIp> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronFloatingIp.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -96,47 +92,31 @@ public final class NeutronFloatingIp
         this.status = status;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return an OpenStackFloatingIps object with only the selected fields
-     *             populated
-     */
-
-    public NeutronFloatingIp extractFields(List<String> fields) {
-        NeutronFloatingIp ans = new NeutronFloatingIp();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "floating_network_id":
-                    ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
-                    break;
-                case "port_id":
-                    ans.setPortUUID(this.getPortUUID());
-                    break;
-                case "fixed_ip_address":
-                    ans.setFixedIpAddress(this.getFixedIpAddress());
-                    break;
-                case "floating_ip_address":
-                    ans.setFloatingIpAddress(this.getFloatingIpAddress());
-                    break;
-                case "router_id":
-                    ans.setRouterUUID(this.getRouterUUID());
-                    break;
-                case "status":
-                    ans.setStatus(this.getStatus());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronFloatingIp suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronFloatingIp ans) {
+        switch (field) {
+            case "floating_network_id":
+                ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
+                break;
+            case "port_id":
+                ans.setPortUUID(this.getPortUUID());
+                break;
+            case "fixed_ip_address":
+                ans.setFixedIpAddress(this.getFixedIpAddress());
+                break;
+            case "floating_ip_address":
+                ans.setFloatingIpAddress(this.getFloatingIpAddress());
+                break;
+            case "router_id":
+                ans.setRouterUUID(this.getRouterUUID());
+                break;
+            case "status":
+                ans.setStatus(this.getStatus());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index d8f0140ae927e8bf7b42371309ee8e9825d41e54..c672c0a3b512628ad30afa285e5205cf2a6d0419 100644 (file)
@@ -13,13 +13,10 @@ import java.util.ArrayList;
 import java.util.List;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement(name = "l2gateway")
 public final class NeutronL2gateway extends NeutronBaseAttributes<NeutronL2gateway>
         implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronL2gateway.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "devices")
@@ -33,24 +30,18 @@ public final class NeutronL2gateway extends NeutronBaseAttributes<NeutronL2gatew
         this.l2gatewayDevices = l2gatewayDevices;
     }
 
-    public NeutronL2gateway extractFields(List<String> fields) {
-        NeutronL2gateway ans = new NeutronL2gateway();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "devices":
-                    List<NeutronL2gatewayDevice> devices = new ArrayList<NeutronL2gatewayDevice>();
-                    devices.addAll(this.getNeutronL2gatewayDevices());
-                    ans.setNeutronL2gatewayDevices(devices);
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronL2gateway suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronL2gateway ans) {
+        switch (field) {
+            case "devices":
+                List<NeutronL2gatewayDevice> devices = new ArrayList<NeutronL2gatewayDevice>();
+                devices.addAll(this.getNeutronL2gatewayDevices());
+                ans.setNeutronL2gatewayDevices(devices);
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index c3cd2012580bd641e55443472beee8eedf7bfdad..b6c300cac76a3deda116d20a287635c81cdfa327 100644 (file)
@@ -9,19 +9,15 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement(name = "l2gatewayConnection")
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronL2gatewayConnection extends NeutronObject<NeutronL2gatewayConnection>
         implements Serializable, INeutronObject<NeutronL2gatewayConnection> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronL2gatewayConnection.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "gateway_id")
@@ -68,34 +64,28 @@ public final class NeutronL2gatewayConnection extends NeutronObject<NeutronL2gat
         this.portID = portID;
     }
 
-    public NeutronL2gatewayConnection extractFields(List<String> fields) {
-        NeutronL2gatewayConnection ans = new NeutronL2gatewayConnection();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "connection_id":
-                    ans.setID(this.getID());
-                    break;
-                case "gateway_id":
-                    ans.setL2gatewayID(this.getL2gatewayID());
-                    break;
-                case "network_id":
-                    ans.setNetworkID(this.getNetworkID());
-                    break;
-                case "segmentation_id":
-                    ans.setSegmentID(this.getSegmentID());
-                    break;
-                case "port_id":
-                    ans.setPortID(this.getPortID());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronL2gatewayConnection suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronL2gatewayConnection ans) {
+        switch (field) {
+            case "connection_id":
+                ans.setID(this.getID());
+                break;
+            case "gateway_id":
+                ans.setL2gatewayID(this.getL2gatewayID());
+                break;
+            case "network_id":
+                ans.setNetworkID(this.getNetworkID());
+                break;
+            case "segmentation_id":
+                ans.setSegmentID(this.getSegmentID());
+                break;
+            case "port_id":
+                ans.setPortID(this.getPortID());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 3a4cb18121f1fe872e42b9817318c4f7eac75e17..9b4dff1741792ac207ab0a42a0472b1021c16bf1 100644 (file)
@@ -9,13 +9,10 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Load Balancer as a service
@@ -36,7 +33,6 @@ import org.slf4j.LoggerFactory;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronLoadBalancer extends NeutronAdminAttributes<NeutronLoadBalancer> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancer.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "vip_address")
@@ -61,25 +57,19 @@ public final class NeutronLoadBalancer extends NeutronAdminAttributes<NeutronLoa
         this.loadBalancerVipSubnetID = loadBalancerVipSubnetID;
     }
 
-    public NeutronLoadBalancer extractFields(List<String> fields) {
-        NeutronLoadBalancer ans = new NeutronLoadBalancer();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "vip_address":
-                    ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
-                    break;
-                case "vip_subnet_id":
-                    ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronLoadBalancer suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronLoadBalancer ans) {
+        switch (field) {
+            case "vip_address":
+                ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
+                break;
+            case "vip_subnet_id":
+                ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 7a6c01614458f3ec2a920e3018d4dc678eb78016..768dbf17146c9421de914129b2d4e6bcadd4ba05 100644 (file)
@@ -14,8 +14,6 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Load Balancer as a service
@@ -42,8 +40,6 @@ import org.slf4j.LoggerFactory;
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronLoadBalancerHealthMonitor extends NeutronObject<NeutronLoadBalancerHealthMonitor>
         implements Serializable, INeutronObject<NeutronLoadBalancerHealthMonitor> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerHealthMonitor.class);
-
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "type")
@@ -145,43 +141,37 @@ public final class NeutronLoadBalancerHealthMonitor extends NeutronObject<Neutro
         this.loadBalancerHealthMonitorPools = loadBalancerHealthMonitorPools;
     }
 
-    public NeutronLoadBalancerHealthMonitor extractFields(List<String> fields) {
-        NeutronLoadBalancerHealthMonitor ans = new NeutronLoadBalancerHealthMonitor();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "type":
-                    ans.setLoadBalancerHealthMonitorType(this.getLoadBalancerHealthMonitorType());
-                    break;
-                case "delay":
-                    ans.setLoadBalancerHealthMonitorDelay(this.getLoadBalancerHealthMonitorDelay());
-                    break;
-                case "timeout":
-                    ans.setLoadBalancerHealthMonitorTimeout(this.getLoadBalancerHealthMonitorTimeout());
-                    break;
-                case "max_retries":
-                    ans.setLoadBalancerHealthMonitorMaxRetries(this.getLoadBalancerHealthMonitorMaxRetries());
-                    break;
-                case "http_method":
-                    ans.setLoadBalancerHealthMonitorHttpMethod(this.getLoadBalancerHealthMonitorHttpMethod());
-                    break;
-                case "url_path":
-                    ans.setLoadBalancerHealthMonitorUrlPath(this.getLoadBalancerHealthMonitorUrlPath());
-                    break;
-                case "expected_codes":
-                    ans.setLoadBalancerHealthMonitorExpectedCodes(this.getLoadBalancerHealthMonitorExpectedCodes());
-                    break;
-                case "admin_state_up":
-                    ans.setLoadBalancerHealthMonitorAdminStateIsUp(loadBalancerHealthMonitorAdminStateIsUp);
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronLoadBalancerHealthMonitor suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronLoadBalancerHealthMonitor ans) {
+        switch (field) {
+            case "type":
+                ans.setLoadBalancerHealthMonitorType(this.getLoadBalancerHealthMonitorType());
+                break;
+            case "delay":
+                ans.setLoadBalancerHealthMonitorDelay(this.getLoadBalancerHealthMonitorDelay());
+                break;
+            case "timeout":
+                ans.setLoadBalancerHealthMonitorTimeout(this.getLoadBalancerHealthMonitorTimeout());
+                break;
+            case "max_retries":
+                ans.setLoadBalancerHealthMonitorMaxRetries(this.getLoadBalancerHealthMonitorMaxRetries());
+                break;
+            case "http_method":
+                ans.setLoadBalancerHealthMonitorHttpMethod(this.getLoadBalancerHealthMonitorHttpMethod());
+                break;
+            case "url_path":
+                ans.setLoadBalancerHealthMonitorUrlPath(this.getLoadBalancerHealthMonitorUrlPath());
+                break;
+            case "expected_codes":
+                ans.setLoadBalancerHealthMonitorExpectedCodes(this.getLoadBalancerHealthMonitorExpectedCodes());
+                break;
+            case "admin_state_up":
+                ans.setLoadBalancerHealthMonitorAdminStateIsUp(loadBalancerHealthMonitorAdminStateIsUp);
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 108f9d4c7352413624124a76db902d16bf093965..05cd2729a62697d0a7311760f9415e3ffac8249e 100644 (file)
@@ -14,8 +14,6 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Load Balancer as a service
@@ -43,7 +41,6 @@ import org.slf4j.LoggerFactory;
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronLoadBalancerListener extends NeutronBaseAttributes<NeutronLoadBalancerListener>
         implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerListener.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "default_pool_id")
@@ -113,31 +110,25 @@ public final class NeutronLoadBalancerListener extends NeutronBaseAttributes<Neu
         this.loadBalancerListenerLoadBalancerIDs = loadBalancerListenerLoadBalancerIDs;
     }
 
-    public NeutronLoadBalancerListener extractFields(List<String> fields) {
-        NeutronLoadBalancerListener ans = new NeutronLoadBalancerListener();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "default_pool_id":
-                    ans.setNeutronLoadBalancerListenerDefaultPoolID(this.getNeutronLoadBalancerListenerDefaultPoolID());
-                    break;
-                case "protocol":
-                    ans.setNeutronLoadBalancerListenerProtocol(this.getNeutronLoadBalancerListenerProtocol());
-                    break;
-                case "protocol_port":
-                    ans.setNeutronLoadBalancerListenerProtocolPort(this.getNeutronLoadBalancerListenerProtocolPort());
-                    break;
-                case "admin_state_up":
-                    ans.setLoadBalancerListenerAdminStateIsUp(loadBalancerListenerAdminStateIsUp);
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronLoadBalancerListener suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronLoadBalancerListener ans) {
+        switch (field) {
+            case "default_pool_id":
+                ans.setNeutronLoadBalancerListenerDefaultPoolID(this.getNeutronLoadBalancerListenerDefaultPoolID());
+                break;
+            case "protocol":
+                ans.setNeutronLoadBalancerListenerProtocol(this.getNeutronLoadBalancerListenerProtocol());
+                break;
+            case "protocol_port":
+                ans.setNeutronLoadBalancerListenerProtocolPort(this.getNeutronLoadBalancerListenerProtocolPort());
+                break;
+            case "admin_state_up":
+                ans.setLoadBalancerListenerAdminStateIsUp(loadBalancerListenerAdminStateIsUp);
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index b0389789b718439552cff88ce4f002430379d424..c69e1f70ad13ede372916b49a63873dc1d03f2b2 100644 (file)
@@ -15,8 +15,6 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Load Balancer as a service
@@ -41,7 +39,6 @@ import org.slf4j.LoggerFactory;
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronLoadBalancerPool extends NeutronBaseAttributes<NeutronLoadBalancerPool>
         implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerPool.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "protocol")
@@ -153,34 +150,28 @@ public final class NeutronLoadBalancerPool extends NeutronBaseAttributes<Neutron
         this.loadBalancerPoolMembers.remove(loadBalancerPoolMember);
     }
 
-    public NeutronLoadBalancerPool extractFields(List<String> fields) {
-        NeutronLoadBalancerPool ans = new NeutronLoadBalancerPool();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "protocol":
-                    ans.setLoadBalancerPoolProtocol(this.getLoadBalancerPoolProtocol());
-                    break;
-                case "lb_algorithm":
-                    ans.setLoadBalancerPoolLbAlgorithm(this.getLoadBalancerPoolLbAlgorithm());
-                    break;
-                case "healthmonitor_id":
-                    ans.setLoadBalancerPoolHealthMonitorID(this.getLoadBalancerPoolHealthMonitorID());
-                    break;
-                case "admin_state_up":
-                    ans.setLoadBalancerPoolAdminStateIsUp(loadBalancerPoolAdminStateIsUp);
-                    break;
-                case "members":
-                    ans.setLoadBalancerPoolMembers(getLoadBalancerPoolMembers());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronLoadBalancerPool suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronLoadBalancerPool ans) {
+        switch (field) {
+            case "protocol":
+                ans.setLoadBalancerPoolProtocol(this.getLoadBalancerPoolProtocol());
+                break;
+            case "lb_algorithm":
+                ans.setLoadBalancerPoolLbAlgorithm(this.getLoadBalancerPoolLbAlgorithm());
+                break;
+            case "healthmonitor_id":
+                ans.setLoadBalancerPoolHealthMonitorID(this.getLoadBalancerPoolHealthMonitorID());
+                break;
+            case "admin_state_up":
+                ans.setLoadBalancerPoolAdminStateIsUp(loadBalancerPoolAdminStateIsUp);
+                break;
+            case "members":
+                ans.setLoadBalancerPoolMembers(getLoadBalancerPoolMembers());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 22e296dc5939bfe0702f2c8389ec77a309fcec2a..f0687bb05e5b9d53443dc1d67e5ca0338005744c 100644 (file)
@@ -9,20 +9,16 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronLoadBalancerPoolMember extends NeutronObject<NeutronLoadBalancerPoolMember>
         implements Serializable, INeutronObject<NeutronLoadBalancerPoolMember> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerPoolMember.class);
     private static final long serialVersionUID = 1L;
 
     /**
@@ -97,37 +93,31 @@ public final class NeutronLoadBalancerPoolMember extends NeutronObject<NeutronLo
         this.poolMemberSubnetID = poolMemberSubnetID;
     }
 
-    public NeutronLoadBalancerPoolMember extractFields(List<String> fields) {
-        NeutronLoadBalancerPoolMember ans = new NeutronLoadBalancerPoolMember();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "pool_id":
-                    ans.setPoolID(this.getPoolID());
-                    break;
-                case "address":
-                    ans.setPoolMemberAddress(this.getPoolMemberAddress());
-                    break;
-                case "protocol_port":
-                    ans.setPoolMemberProtoPort(this.getPoolMemberProtoPort());
-                    break;
-                case "admin_state_up":
-                    ans.setPoolMemberAdminStateIsUp(poolMemberAdminStateIsUp);
-                    break;
-                case "weight":
-                    ans.setPoolMemberWeight(this.getPoolMemberWeight());
-                    break;
-                case "subnet_id":
-                    ans.setPoolMemberSubnetID(this.getPoolMemberSubnetID());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronLoadBalancerPoolMember suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronLoadBalancerPoolMember ans) {
+        switch (field) {
+            case "pool_id":
+                ans.setPoolID(this.getPoolID());
+                break;
+            case "address":
+                ans.setPoolMemberAddress(this.getPoolMemberAddress());
+                break;
+            case "protocol_port":
+                ans.setPoolMemberProtoPort(this.getPoolMemberProtoPort());
+                break;
+            case "admin_state_up":
+                ans.setPoolMemberAdminStateIsUp(poolMemberAdminStateIsUp);
+                break;
+            case "weight":
+                ans.setPoolMemberWeight(this.getPoolMemberWeight());
+                break;
+            case "subnet_id":
+                ans.setPoolMemberSubnetID(this.getPoolMemberSubnetID());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index f4319d9950b45cb0b83c3b3579960592cbf20963..3f8beda011c8d984e6ed323a92e4e6aa70d760fe 100644 (file)
@@ -9,18 +9,14 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronMeteringLabel extends NeutronBaseAttributes<NeutronMeteringLabel> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerPoolMember.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(defaultValue = "false", name = "shared")
@@ -50,30 +46,15 @@ public final class NeutronMeteringLabel extends NeutronBaseAttributes<NeutronMet
                 + ", shared=" + shared + "]";
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return a NeutronMeteringLabel object with only the selected fields
-     *             populated
-     */
-    public NeutronMeteringLabel extractFields(List<String> fields) {
-        NeutronMeteringLabel ans = new NeutronMeteringLabel();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "shared":
-                    ans.setMeteringLabelShared(this.getMeteringLabelShared());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronMeteringLabel suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronMeteringLabel ans) {
+        switch (field) {
+            case "shared":
+                ans.setMeteringLabelShared(this.getMeteringLabelShared());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 }
index 81c2598f46e296d9c0c5d398e8ae1c55b3dbc403..6ee9f552b43a0310a7fa51e3fe4701e1a38be059 100644 (file)
@@ -9,19 +9,15 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronMeteringLabelRule extends NeutronObject<NeutronMeteringLabelRule>
         implements Serializable, INeutronObject<NeutronMeteringLabelRule> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronMeteringLabelRule.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "direction")
@@ -85,39 +81,24 @@ public final class NeutronMeteringLabelRule extends NeutronObject<NeutronMeterin
                 + meteringLabelRuleRemoteIpPrefix + ", metering_label_id=" + meteringLabelRuleLabelID + "]";
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return a NeutronMeteringLabelRule object with only the selected fields
-     *             populated
-     */
-    public NeutronMeteringLabelRule extractFields(List<String> fields) {
-        NeutronMeteringLabelRule ans = new NeutronMeteringLabelRule();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "direction":
-                    ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
-                    break;
-                case "excluded":
-                    ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
-                    break;
-                case "remote_ip_prefix":
-                    ans.setMeteringLabelRuleRemoteIpPrefix(this.getMeteringLabelRuleRemoteIpPrefix());
-                    break;
-                case "metering_label_id":
-                    ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronMeteringLabelRule suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronMeteringLabelRule ans) {
+        switch (field) {
+            case "direction":
+                ans.setMeteringLabelRuleDirection(this.getMeteringLabelRuleDirection());
+                break;
+            case "excluded":
+                ans.setMeteringLabelRuleExcluded(this.getMeteringLabelRuleExcluded());
+                break;
+            case "remote_ip_prefix":
+                ans.setMeteringLabelRuleRemoteIpPrefix(this.getMeteringLabelRuleRemoteIpPrefix());
+                break;
+            case "metering_label_id":
+                ans.setMeteringLabelRuleLabelID(this.getMeteringLabelRuleLabelID());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 }
index 63f1be24b9cc0adee9d788698f12e4dc1b74bb9b..5c48228eeb6ccb7b169d03554aca86ff3817f6c7 100644 (file)
@@ -14,13 +14,10 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement(name = "network")
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronNetwork extends NeutronAdminAttributes<NeutronNetwork> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronNetwork.class);
     // See OpenStack Network API v2.0 Reference for description of
     // annotated attributes
 
@@ -162,47 +159,31 @@ public final class NeutronNetwork extends NeutronAdminAttributes<NeutronNetwork>
         this.qosPolicyId = qosPolicyId;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return an OpenStackNetworks object with only the selected fields
-     *             populated
-     */
-
-    public NeutronNetwork extractFields(List<String> fields) {
-        NeutronNetwork ans = new NeutronNetwork();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "shared":
-                    ans.setShared(shared);
-                    break;
-                case "external":
-                    ans.setRouterExternal(this.getRouterExternal());
-                    break;
-                case "segmentation_id":
-                    ans.setProviderSegmentationID(this.getProviderSegmentationID());
-                    break;
-                case "physical_network":
-                    ans.setProviderPhysicalNetwork(this.getProviderPhysicalNetwork());
-                    break;
-                case "network_type":
-                    ans.setProviderNetworkType(this.getProviderNetworkType());
-                    break;
-                case "qos_policy_id":
-                    ans.setQosPolicyId(this.getQosPolicyId());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronNetwork suitable field.", s);
-                    break;
-            }
+    @Override
+    public boolean extractField(String field, NeutronNetwork ans) {
+        switch (field) {
+            case "shared":
+                ans.setShared(shared);
+                break;
+            case "external":
+                ans.setRouterExternal(this.getRouterExternal());
+                break;
+            case "segmentation_id":
+                ans.setProviderSegmentationID(this.getProviderSegmentationID());
+                break;
+            case "physical_network":
+                ans.setProviderPhysicalNetwork(this.getProviderPhysicalNetwork());
+                break;
+            case "network_type":
+                ans.setProviderNetworkType(this.getProviderNetworkType());
+                break;
+            case "qos_policy_id":
+                ans.setQosPolicyId(this.getQosPolicyId());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 7e3f74e2129a3c19b893daba264a558452cb0a35..8fcaf78074f0201cfffd0ff8d29e740602645ab3 100644 (file)
@@ -11,17 +11,26 @@ package org.opendaylight.neutron.spi;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import java.io.Serializable;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public abstract class NeutronObject<T extends NeutronObject> extends NeutronID
         implements Serializable, INeutronObject<T> {
+    // T extends NeutronObject as 0th type argument. Used by extractFields()
+    private static final int NEUTRON_OBJECT_CLASS_TYPE_INDEX = 0;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronFirewallRule.class);
+
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "tenant_id")
@@ -93,8 +102,36 @@ public abstract class NeutronObject<T extends NeutronObject> extends NeutronID
         }
     }
 
+    /**
+     * This method copies selected fields from the object and returns them
+     * as a new object, suitable for marshaling.
+     *
+     * @param fields
+     *            List of attributes to be extracted
+     * @return an OpenStack Neutron object with only the selected fields
+     *             populated
+     */
+
     @Override
-    public abstract T extractFields(List<String> fields);
+    public T extractFields(List<String> fields) {
+        ParameterizedType parameterizedType = (ParameterizedType) getClass().getGenericSuperclass();
+        Type[] types = parameterizedType.getActualTypeArguments();
+        @SuppressWarnings("unchecked")
+        Class<T> cls = (Class<T>) types[NEUTRON_OBJECT_CLASS_TYPE_INDEX];
+        T ans;
+        try {
+            ans = cls.newInstance();
+        } catch (IllegalAccessException | InstantiationException e) {
+            // should not happen.
+            throw new IllegalStateException(e);
+        }
+        for (String s : fields) {
+            if (!extractField(s, ans)) {
+                LOGGER.warn("Unknown {} {}.", cls.getSimpleName(), s);
+            }
+        }
+        return ans;
+    }
 
     protected boolean extractField(String field, T ans) {
         switch (field) {
index 4da69d56e8c00ca04ae76ba7881b3e1193bceb65..b36cbf5699e3a8bf09cf77157e01ce3bf784dfb7 100644 (file)
@@ -18,13 +18,10 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronPort extends NeutronAdminAttributes<NeutronPort> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronPort.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -203,72 +200,56 @@ public final class NeutronPort extends NeutronAdminAttributes<NeutronPort> imple
         portSecurityEnabled = newValue;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return an OpenStackPorts object with only the selected fields
-     *             populated
-     */
-
-    public NeutronPort extractFields(List<String> fields) {
-        NeutronPort ans = new NeutronPort();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "network_id":
-                    ans.setNetworkUUID(this.getNetworkUUID());
-                    break;
-                case "mac_address":
-                    ans.setMacAddress(this.getMacAddress());
-                    break;
-                case "fixed_ips":
-                    ans.setFixedIps(new ArrayList<NeutronIps>(this.getFixedIps()));
-                    break;
-                case "device_id":
-                    ans.setDeviceID(this.getDeviceID());
-                    break;
-                case "device_owner":
-                    ans.setDeviceOwner(this.getDeviceOwner());
-                    break;
-                case "security_groups":
-                    ans.setSecurityGroups(new ArrayList<NeutronSecurityGroup>(this.getSecurityGroups()));
-                    break;
-                case "allowed_address_pairs":
-                    ans.setAllowedAddressPairs(
-                            new ArrayList<NeutronPortAllowedAddressPairs>(this.getAllowedAddressPairs()));
-                    break;
-                case "binding:host_id":
-                    ans.setBindinghostID(this.getBindinghostID());
-                    break;
-                case "binding:vnic_type":
-                    ans.setBindingvnicType(this.getBindingvnicType());
-                    break;
-                case "binding:vif_type":
-                    ans.setBindingvifType(this.getBindingvifType());
-                    break;
-                case "binding:vif_details":
-                    ans.setVIFDetails(new HashMap<String, String>(this.getVIFDetails()));
-                    break;
-                case "extra_dhcp_opts":
-                    ans.setExtraDHCPOptions(new ArrayList<NeutronPortExtraDHCPOption>(this.getExtraDHCPOptions()));
-                    break;
-                case "port_security_enabled":
-                    ans.setPortSecurityEnabled(this.getPortSecurityEnabled());
-                    break;
-                case "qos_policy_id":
-                    ans.setQosPolicyId(this.getQosPolicyId());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronPort suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronPort ans) {
+        switch (field) {
+            case "network_id":
+                ans.setNetworkUUID(this.getNetworkUUID());
+                break;
+            case "mac_address":
+                ans.setMacAddress(this.getMacAddress());
+                break;
+            case "fixed_ips":
+                ans.setFixedIps(new ArrayList<NeutronIps>(this.getFixedIps()));
+                break;
+            case "device_id":
+                ans.setDeviceID(this.getDeviceID());
+                break;
+            case "device_owner":
+                ans.setDeviceOwner(this.getDeviceOwner());
+                break;
+            case "security_groups":
+                ans.setSecurityGroups(new ArrayList<NeutronSecurityGroup>(this.getSecurityGroups()));
+                break;
+            case "allowed_address_pairs":
+                ans.setAllowedAddressPairs(
+                        new ArrayList<NeutronPortAllowedAddressPairs>(this.getAllowedAddressPairs()));
+                break;
+            case "binding:host_id":
+                ans.setBindinghostID(this.getBindinghostID());
+                break;
+            case "binding:vnic_type":
+                ans.setBindingvnicType(this.getBindingvnicType());
+                break;
+            case "binding:vif_type":
+                ans.setBindingvifType(this.getBindingvifType());
+                break;
+            case "binding:vif_details":
+                ans.setVIFDetails(new HashMap<String, String>(this.getVIFDetails()));
+                break;
+            case "extra_dhcp_opts":
+                ans.setExtraDHCPOptions(new ArrayList<NeutronPortExtraDHCPOption>(this.getExtraDHCPOptions()));
+                break;
+            case "port_security_enabled":
+                ans.setPortSecurityEnabled(this.getPortSecurityEnabled());
+                break;
+            case "qos_policy_id":
+                ans.setQosPolicyId(this.getQosPolicyId());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 15f755f2dbfdb6686abd74ab82bc18a293760ff3..8a6e573f1ff59f7aef8d79c9a26f5693e7bc0d72 100644 (file)
@@ -10,19 +10,15 @@ package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
 import java.math.BigInteger;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronQosBandwidthRule extends NeutronObject<NeutronQosBandwidthRule>
         implements Serializable, INeutronObject<NeutronQosBandwidthRule> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronQosBandwidthRule.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "max_kbps")
@@ -47,25 +43,19 @@ public final class NeutronQosBandwidthRule extends NeutronObject<NeutronQosBandw
         this.maxBurstKbps = maxBurstKbps;
     }
 
-    public NeutronQosBandwidthRule extractFields(List<String> fields) {
-        NeutronQosBandwidthRule ans = new NeutronQosBandwidthRule();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "max_kbps":
-                    ans.setMaxKbps(this.getMaxKbps());
-                    break;
-                case "max_burst_kbps":
-                    ans.setMaxBurstKbps(this.getMaxBurstKbps());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronQosBandwidthRule suitable field.", s);
-                    break;
-            }
+    @Override
+    public boolean extractField(String field, NeutronQosBandwidthRule ans) {
+        switch (field) {
+            case "max_kbps":
+                ans.setMaxKbps(this.getMaxKbps());
+                break;
+            case "max_burst_kbps":
+                ans.setMaxBurstKbps(this.getMaxBurstKbps());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 5ecf1de35c2e0620180326cac36489453c973f30..9d5a15c731b39f543697bb22981554ecb006f67c 100644 (file)
@@ -9,19 +9,15 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronQosDscpMarkingRule extends NeutronObject<NeutronQosDscpMarkingRule>
         implements Serializable, INeutronObject<NeutronQosDscpMarkingRule> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronQosDscpMarkingRule.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "dscp_mark")
@@ -35,22 +31,16 @@ public final class NeutronQosDscpMarkingRule extends NeutronObject<NeutronQosDsc
         this.dscpMark = dscpMark;
     }
 
-    public NeutronQosDscpMarkingRule extractFields(List<String> fields) {
-        NeutronQosDscpMarkingRule ans = new NeutronQosDscpMarkingRule();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "dscp_mark":
-                    ans.setDscpMark(this.getDscpMark());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronQosDscpMarkingRule suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronQosDscpMarkingRule ans) {
+        switch (field) {
+            case "dscp_mark":
+                ans.setDscpMark(this.getDscpMark());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 28aaad7feaa7ec9a9489a7f6652859c7233235e8..cf26221fc9dc933f15547f1c116c5c5aacbe715b 100644 (file)
@@ -15,13 +15,10 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronQosPolicy extends NeutronBaseAttributes<NeutronQosPolicy> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronQosPolicy.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(defaultValue = "false", name = "shared")
@@ -57,32 +54,26 @@ public final class NeutronQosPolicy extends NeutronBaseAttributes<NeutronQosPoli
         this.dscpRules = qosDscpRules;
     }
 
-    public NeutronQosPolicy extractFields(List<String> fields) {
-        NeutronQosPolicy ans = new NeutronQosPolicy();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "shared":
-                    ans.setPolicyIsShared(this.getPolicyIsShared());
-                    break;
-                case "bandwidth_limit_rules":
-                    List<NeutronQosBandwidthRule> qosBwRuleList = new ArrayList<>();
-                    qosBwRuleList.addAll(this.getBwLimitRules());
-                    ans.setQosBwLimitRules(qosBwRuleList);
-                    break;
-                case "dscp_marking_rules":
-                    List<NeutronQosDscpMarkingRule> qosDscpRuleList = new ArrayList<>();
-                    qosDscpRuleList.addAll(this.getDscpRules());
-                    ans.setDscpRules(qosDscpRuleList);
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronQosPolicy suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronQosPolicy ans) {
+        switch (field) {
+            case "shared":
+                ans.setPolicyIsShared(this.getPolicyIsShared());
+                break;
+            case "bandwidth_limit_rules":
+                List<NeutronQosBandwidthRule> qosBwRuleList = new ArrayList<>();
+                qosBwRuleList.addAll(this.getBwLimitRules());
+                ans.setQosBwLimitRules(qosBwRuleList);
+                break;
+            case "dscp_marking_rules":
+                List<NeutronQosDscpMarkingRule> qosDscpRuleList = new ArrayList<>();
+                qosDscpRuleList.addAll(this.getDscpRules());
+                ans.setDscpRules(qosDscpRuleList);
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 536aab55289d4348fa2cac01b4c8a58ba828ccd6..e9a1e328fcc9b3b33ad10219d5909e80c9d5d053 100644 (file)
@@ -14,14 +14,11 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronRouter extends NeutronAdminAttributes<NeutronRouter>
         implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronRouter.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -80,40 +77,25 @@ public final class NeutronRouter extends NeutronAdminAttributes<NeutronRouter>
         this.routes = routes;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return an OpenStackRouters object with only the selected fields
-     *             populated
-     */
-    public NeutronRouter extractFields(List<String> fields) {
-        NeutronRouter ans = new NeutronRouter();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "external_gateway_info":
-                    ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
-                    break;
-                case "distributed":
-                    ans.setDistributed(this.getDistributed());
-                    break;
-                case "gw_port_id":
-                    ans.setGatewayPortId(this.getGatewayPortId());
-                    break;
-                case "routes":
-                    ans.setRoutes(this.getRoutes());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronRouter suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronRouter ans) {
+        switch (field) {
+            case "external_gateway_info":
+                ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
+                break;
+            case "distributed":
+                ans.setDistributed(this.getDistributed());
+                break;
+            case "gw_port_id":
+                ans.setGatewayPortId(this.getGatewayPortId());
+                break;
+            case "routes":
+                ans.setRoutes(this.getRoutes());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index b8e28ccec796da4e0282eca77e00e8da538b6d24..99e2b953f3c3bcd7ea1b04acc065efe2aabab5d3 100644 (file)
@@ -9,19 +9,15 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronRouterInterface extends NeutronObject<NeutronRouterInterface>
         implements Serializable, INeutronObject<NeutronRouterInterface> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronRouterInterface.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -58,25 +54,18 @@ public final class NeutronRouterInterface extends NeutronObject<NeutronRouterInt
     }
 
     @Override
-    public NeutronRouterInterface extractFields(List<String> fields) {
-        NeutronRouterInterface ans = new NeutronRouterInterface();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "subnet_id":
-                    ans.setSubnetUUID(this.getSubnetUUID());
-                    break;
-                case "port_id":
-                    ans.setPortUUID(this.getPortUUID());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronRouterInterface suitable field.", s);
-                    break;
-            }
+    protected boolean extractField(String field, NeutronRouterInterface ans) {
+        switch (field) {
+            case "subnet_id":
+                ans.setSubnetUUID(this.getSubnetUUID());
+                break;
+            case "port_id":
+                ans.setPortUUID(this.getPortUUID());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 7eb3a2af9b52c0909922ebea940b8bc32bd79792..afe21fcc2236abeae4834053648e7c46e2299e75 100644 (file)
@@ -9,21 +9,17 @@ package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSFCFlowClassifier extends NeutronBaseAttributes<NeutronSFCFlowClassifier>
         implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSFCFlowClassifier.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Networking SFC (networking-sfc) API v1.0 Reference for description of
@@ -153,58 +149,43 @@ public final class NeutronSFCFlowClassifier extends NeutronBaseAttributes<Neutro
         this.l7Parameters = l7Parameters;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields List of attributes to be extracted
-     * @return an OpenStack NeutronSFCFlowClassifier object with only the selected fields
-     *             populated
-     */
-
-    public NeutronSFCFlowClassifier extractFields(List<String> fields) {
-        NeutronSFCFlowClassifier ans = new NeutronSFCFlowClassifier();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "ethertype":
-                    ans.setEthertype(this.getEthertype());
-                    break;
-                case "source_port_range_min":
-                    ans.setSourcePortRangeMin(this.getSourcePortRangeMin());
-                    break;
-                case "source_port_range_max":
-                    ans.setSourcePortRangeMax(this.getSourcePortRangeMax());
-                    break;
-                case "destination_port_range_min":
-                    ans.setDestinationPortRangeMin(this.getDestinationPortRangeMin());
-                    break;
-                case "destination_port_range_max":
-                    ans.setDestinationPortRangeMax(this.getDestinationPortRangeMax());
-                    break;
-                case "source_ip_prefix":
-                    ans.setSourceIpPrefix(this.getSourceIpPrefix());
-                    break;
-                case "destination_ip_prefix":
-                    ans.setDestinationIpPrefix(this.getDestinationIpPrefix());
-                    break;
-                case "logical_source_port":
-                    ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
-                    break;
-                case "logical_destination_port":
-                    ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
-                    break;
-                case "l7_parameters":
-                    ans.setL7Parameters(new HashMap<String, String>(this.getL7Parameters()));
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronSFCFlowClassifier suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronSFCFlowClassifier ans) {
+        switch (field) {
+            case "ethertype":
+                ans.setEthertype(this.getEthertype());
+                break;
+            case "source_port_range_min":
+                ans.setSourcePortRangeMin(this.getSourcePortRangeMin());
+                break;
+            case "source_port_range_max":
+                ans.setSourcePortRangeMax(this.getSourcePortRangeMax());
+                break;
+            case "destination_port_range_min":
+                ans.setDestinationPortRangeMin(this.getDestinationPortRangeMin());
+                break;
+            case "destination_port_range_max":
+                ans.setDestinationPortRangeMax(this.getDestinationPortRangeMax());
+                break;
+            case "source_ip_prefix":
+                ans.setSourceIpPrefix(this.getSourceIpPrefix());
+                break;
+            case "destination_ip_prefix":
+                ans.setDestinationIpPrefix(this.getDestinationIpPrefix());
+                break;
+            case "logical_source_port":
+                ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
+                break;
+            case "logical_destination_port":
+                ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
+                break;
+            case "l7_parameters":
+                ans.setL7Parameters(new HashMap<String, String>(this.getL7Parameters()));
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index b59468877164d6d26fc82e7f6b656831150f56a2..4db17cdf0954d0f80275414851e10e4a18c703dc 100644 (file)
@@ -15,13 +15,10 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSFCPortChain extends NeutronBaseAttributes<NeutronSFCPortChain> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSFCPortChain.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Networking SFC (networking-sfc) Port Chain API v1.0 Reference
@@ -64,37 +61,22 @@ public final class NeutronSFCPortChain extends NeutronBaseAttributes<NeutronSFCP
         this.chainParameters = chainParameters;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields List of attributes to be extracted
-     * @return an OpenStack Neutron SFC Port Chain object with only the selected fields
-     *             populated
-     */
-
-    public NeutronSFCPortChain extractFields(List<String> fields) {
-        NeutronSFCPortChain ans = new NeutronSFCPortChain();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "port_pair_groups":
-                    ans.setPortPairGroupsUUID(this.getPortPairGroupsUUID());
-                    break;
-                case "flow_classifiers":
-                    ans.setFlowClassifiersUUID(this.getFlowClassifiersUUID());
-                    break;
-                case "chain_parameters":
-                    ans.setChainParameters(this.getChainParameters());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronSFCPortChain suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronSFCPortChain ans) {
+        switch (field) {
+            case "port_pair_groups":
+                ans.setPortPairGroupsUUID(this.getPortPairGroupsUUID());
+                break;
+            case "flow_classifiers":
+                ans.setFlowClassifiersUUID(this.getFlowClassifiersUUID());
+                break;
+            case "chain_parameters":
+                ans.setChainParameters(this.getChainParameters());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 13d1c2a246162f06d8ab7f43344756923782e62d..af3130e01390d160e60ff76b5497d2d06d605aea 100644 (file)
@@ -9,20 +9,16 @@ package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSFCPortPair extends NeutronBaseAttributes<NeutronSFCPortPair> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSFCPortPair.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Networking SFC (networking-sfc) Port Pair API v1.0 Reference
@@ -64,37 +60,22 @@ public final class NeutronSFCPortPair extends NeutronBaseAttributes<NeutronSFCPo
         this.serviceFunctionParameters = serviceFunctionParameters;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields List of attributes to be extracted
-     * @return an OpenStack Neutron SFC Port Pair object with only the selected fields
-     *             populated
-     */
-
-    public NeutronSFCPortPair extractFields(List<String> fields) {
-        NeutronSFCPortPair ans = new NeutronSFCPortPair();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "ingress":
-                    ans.setIngressPortUUID(this.getIngressPortUUID());
-                    break;
-                case "egress":
-                    ans.setEgressPortUUID(this.getEgressPortUUID());
-                    break;
-                case "service_function_parameters":
-                    ans.setServiceFunctionParameters(new HashMap<String, String>(this.getServiceFunctionParameters()));
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronSFCPortPair suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronSFCPortPair ans) {
+        switch (field) {
+            case "ingress":
+                ans.setIngressPortUUID(this.getIngressPortUUID());
+                break;
+            case "egress":
+                ans.setEgressPortUUID(this.getEgressPortUUID());
+                break;
+            case "service_function_parameters":
+                ans.setServiceFunctionParameters(new HashMap<String, String>(this.getServiceFunctionParameters()));
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index a1e7d9daf14b46daa2279d7245f3272e3f7a5d9b..ecf4c5459f1d31b566a5043397a7b413216611f9 100644 (file)
@@ -13,14 +13,11 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSFCPortPairGroup extends NeutronBaseAttributes<NeutronSFCPortPairGroup>
         implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSFCPortPairGroup.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Networking SFC (networking-sfc) Port Pair Group API v1.0
@@ -40,31 +37,16 @@ public final class NeutronSFCPortPairGroup extends NeutronBaseAttributes<Neutron
         this.portPairs = portPairs;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields List of attributes to be extracted
-     * @return an OpenStack Neutron SFC Port Pair Group object with only the selected fields
-     *             populated
-     */
-
-    public NeutronSFCPortPairGroup extractFields(List<String> fields) {
-        NeutronSFCPortPairGroup ans = new NeutronSFCPortPairGroup();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "port_pairs":
-                    ans.setPortPairs(this.getPortPairs());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronSFCPortPairGroup suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronSFCPortPairGroup ans) {
+        switch (field) {
+            case "port_pairs":
+                ans.setPortPairs(this.getPortPairs());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index ca927c55e4d575e6ca14659b032462a9469d7313..c876ae3930122b55830d13b0aa85aed1c8937568 100644 (file)
@@ -9,12 +9,9 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * OpenStack Neutron v2.0 Security Group bindings.
@@ -30,23 +27,11 @@ import org.slf4j.LoggerFactory;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSecurityGroup extends NeutronBaseAttributes<NeutronSecurityGroup> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSecurityGroup.class);
     private static final long serialVersionUID = 1L;
 
     public NeutronSecurityGroup() {
     }
 
-    public NeutronSecurityGroup extractFields(List<String> fields) {
-        NeutronSecurityGroup ans = new NeutronSecurityGroup();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            LOGGER.warn("{} is not a NeutronSecurityGroup suitable field.", s);
-        }
-        return ans;
-    }
-
     @Override
     public String toString() {
         return "NeutronSecurityGroup{" + "securityGroupUUID='" + uuid + '\'' + ", securityGroupName='"
index 00363e16b660f446e8dcb5124632f20bea56f407..bdfb2021048e28227d5925abe3ae988ad243a0bf 100644 (file)
@@ -9,13 +9,10 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * See OpenStack Network API v2.0 Reference for description of
@@ -38,7 +35,6 @@ import org.slf4j.LoggerFactory;
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronSecurityRule extends NeutronObject<NeutronSecurityRule>
         implements Serializable, INeutronObject<NeutronSecurityRule> {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSecurityRule.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "direction")
@@ -132,43 +128,37 @@ public final class NeutronSecurityRule extends NeutronObject<NeutronSecurityRule
         this.securityRuleGroupID = securityRuleGroupID;
     }
 
-    public NeutronSecurityRule extractFields(List<String> fields) {
-        NeutronSecurityRule ans = new NeutronSecurityRule();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "direction":
-                    ans.setSecurityRuleDirection(this.getSecurityRuleDirection());
-                    break;
-                case "protocol":
-                    ans.setSecurityRuleProtocol(this.getSecurityRuleProtocol());
-                    break;
-                case "port_range_min":
-                    ans.setSecurityRulePortMin(this.getSecurityRulePortMin());
-                    break;
-                case "port_range_max":
-                    ans.setSecurityRulePortMax(this.getSecurityRulePortMax());
-                    break;
-                case "ethertype":
-                    ans.setSecurityRuleEthertype(this.getSecurityRuleEthertype());
-                    break;
-                case "remote_ip_prefix":
-                    ans.setSecurityRuleRemoteIpPrefix(this.getSecurityRuleRemoteIpPrefix());
-                    break;
-                case "remote_group_id":
-                    ans.setSecurityRemoteGroupID(this.getSecurityRemoteGroupID());
-                    break;
-                case "security_group_id":
-                    ans.setSecurityRuleGroupID(this.getSecurityRuleGroupID());
-                    break;
-                default:
-                    LOGGER.warn("{} is not a NeutronSecurityRule suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronSecurityRule ans) {
+        switch (field) {
+            case "direction":
+                ans.setSecurityRuleDirection(this.getSecurityRuleDirection());
+                break;
+            case "protocol":
+                ans.setSecurityRuleProtocol(this.getSecurityRuleProtocol());
+                break;
+            case "port_range_min":
+                ans.setSecurityRulePortMin(this.getSecurityRulePortMin());
+                break;
+            case "port_range_max":
+                ans.setSecurityRulePortMax(this.getSecurityRulePortMax());
+                break;
+            case "ethertype":
+                ans.setSecurityRuleEthertype(this.getSecurityRuleEthertype());
+                break;
+            case "remote_ip_prefix":
+                ans.setSecurityRuleRemoteIpPrefix(this.getSecurityRuleRemoteIpPrefix());
+                break;
+            case "remote_group_id":
+                ans.setSecurityRemoteGroupID(this.getSecurityRemoteGroupID());
+                break;
+            case "security_group_id":
+                ans.setSecurityRuleGroupID(this.getSecurityRuleGroupID());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 2ff8957c9d531d6fae4b0105652cd000ad3be9a1..289e4bdfb7463bf8af54cc35e79f2074a6d9e105 100644 (file)
@@ -156,65 +156,49 @@ public final class NeutronSubnet extends NeutronBaseAttributes<NeutronSubnet> im
         this.ipV6RaMode = ipV6RaMode;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return an OpenStackSubnets object with only the selected fields
-     *             populated
-     */
-
-    public NeutronSubnet extractFields(List<String> fields) {
-        NeutronSubnet ans = new NeutronSubnet();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "network_id":
-                    ans.setNetworkUUID(this.getNetworkUUID());
-                    break;
-                case "ip_version":
-                    ans.setIpVersion(this.getIpVersion());
-                    break;
-                case "cidr":
-                    ans.setCidr(this.getCidr());
-                    break;
-                case "gateway_ip":
-                    ans.setGatewayIp(this.getGatewayIp());
-                    break;
-                case "dns_nameservers":
-                    List<String> nsList = new ArrayList<String>();
-                    nsList.addAll(this.getDnsNameservers());
-                    ans.setDnsNameservers(nsList);
-                    break;
-                case "allocation_pools":
-                    List<NeutronSubnetIpAllocationPool> pools = new ArrayList<NeutronSubnetIpAllocationPool>();
-                    pools.addAll(this.getAllocationPools());
-                    ans.setAllocationPools(pools);
-                    break;
-                case "host_routes":
-                    List<NeutronRoute> hostRoutes = new ArrayList<NeutronRoute>();
-                    hostRoutes.addAll(this.getHostRoutes());
-                    ans.setHostRoutes(hostRoutes);
-                    break;
-                case "enable_dhcp":
-                    ans.setEnableDHCP(this.getEnableDHCP());
-                    break;
-                case "ipv6_address_mode":
-                    ans.setIpV6AddressMode(this.getIpV6AddressMode());
-                    break;
-                case "ipv6_ra_mode":
-                    ans.setIpV6RaMode(this.getIpV6RaMode());
-                    break;
-                default:
-                    LOGGER.warn("{} is not an OpenStackSubnet suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronSubnet ans) {
+        switch (field) {
+            case "network_id":
+                ans.setNetworkUUID(this.getNetworkUUID());
+                break;
+            case "ip_version":
+                ans.setIpVersion(this.getIpVersion());
+                break;
+            case "cidr":
+                ans.setCidr(this.getCidr());
+                break;
+            case "gateway_ip":
+                ans.setGatewayIp(this.getGatewayIp());
+                break;
+            case "dns_nameservers":
+                List<String> nsList = new ArrayList<String>();
+                nsList.addAll(this.getDnsNameservers());
+                ans.setDnsNameservers(nsList);
+                break;
+            case "allocation_pools":
+                List<NeutronSubnetIpAllocationPool> pools = new ArrayList<NeutronSubnetIpAllocationPool>();
+                pools.addAll(this.getAllocationPools());
+                ans.setAllocationPools(pools);
+                break;
+            case "host_routes":
+                List<NeutronRoute> hostRoutes = new ArrayList<NeutronRoute>();
+                hostRoutes.addAll(this.getHostRoutes());
+                ans.setHostRoutes(hostRoutes);
+                break;
+            case "enable_dhcp":
+                ans.setEnableDHCP(this.getEnableDHCP());
+                break;
+            case "ipv6_address_mode":
+                ans.setIpV6AddressMode(this.getIpV6AddressMode());
+                break;
+            case "ipv6_ra_mode":
+                ans.setIpV6RaMode(this.getIpV6RaMode());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     /* test to see if the cidr address used to define this subnet
index 70706af8e96edffafb934fe522f8e31b9dd9f65e..5530223ba32cc22e9f3b4329992a7ed1ce2c59a7 100644 (file)
@@ -15,13 +15,10 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement(name = "trunk")
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronTrunk extends NeutronAdminAttributes<NeutronTrunk> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronTrunk.class);
     private static final long serialVersionUID = 1L;
 
     @XmlElement(name = "port_id")
@@ -62,40 +59,21 @@ public final class NeutronTrunk extends NeutronAdminAttributes<NeutronTrunk> imp
         this.subPorts = subPorts;
     }
 
-
-
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return an OpenStackTrunk object with only the selected fields
-     *             populated
-     */
-
     @Override
-    public NeutronTrunk extractFields(List<String> fields) {
-        NeutronTrunk ans = new NeutronTrunk();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "port_id":
-                    ans.setPortId(this.getPortId());
-                    break;
-                case "sub_ports":
-                    List<NeutronTrunkSubPort> subPortList = new ArrayList<>();
-                    subPortList.addAll(this.getSubPorts());
-                    ans.setSubPorts(subPortList);
-                    break;
-                default:
-                    LOGGER.warn("{} is not an NeutronTrunk suitable field.", s);
-                    break;
-            }
+    protected boolean extractField(String field, NeutronTrunk ans) {
+        switch (field) {
+            case "port_id":
+                ans.setPortId(this.getPortId());
+                break;
+            case "sub_ports":
+                List<NeutronTrunkSubPort> subPortList = new ArrayList<>();
+                subPortList.addAll(this.getSubPorts());
+                ans.setSubPorts(subPortList);
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index b8131428af156b86bab3625a763069dfd33144d8..307aa2459e372c10e009686a195a086b4727d00b 100644 (file)
@@ -9,18 +9,14 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronVpnIkePolicy extends NeutronBaseAttributes<NeutronVpnIkePolicy> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronVpnIkePolicy.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -95,42 +91,27 @@ public final class NeutronVpnIkePolicy extends NeutronBaseAttributes<NeutronVpnI
         this.lifetime = lifetime;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return a NeutronVpnIkePolicy object with only the selected fields
-     *             populated
-     */
-    public NeutronVpnIkePolicy extractFields(List<String> fields) {
-        NeutronVpnIkePolicy ans = new NeutronVpnIkePolicy();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "auth_algorithm":
-                    ans.setAuthAlgorithm(this.getAuthAlgorithm());
-                    break;
-                case "encryption_algorithm":
-                    ans.setEncryptionAlgorithm(this.getEncryptionAlgorithm());
-                    break;
-                case "phase1_negotiation_mode":
-                    ans.setPhase1NegotiationMode(this.getPhase1NegotiationMode());
-                    break;
-                case "pfs":
-                    ans.setPerfectForwardSecrecy(this.getPerfectForwardSecrecy());
-                    break;
-                case "ike_version":
-                    ans.setIkeVersion(this.getIkeVersion());
-                    break;
-                default:
-                    LOGGER.warn("{} is not an NeutronVpnIkePolicy suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronVpnIkePolicy ans) {
+        switch (field) {
+            case "auth_algorithm":
+                ans.setAuthAlgorithm(this.getAuthAlgorithm());
+                break;
+            case "encryption_algorithm":
+                ans.setEncryptionAlgorithm(this.getEncryptionAlgorithm());
+                break;
+            case "phase1_negotiation_mode":
+                ans.setPhase1NegotiationMode(this.getPhase1NegotiationMode());
+                break;
+            case "pfs":
+                ans.setPerfectForwardSecrecy(this.getPerfectForwardSecrecy());
+                break;
+            case "ike_version":
+                ans.setIkeVersion(this.getIkeVersion());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 }
index 739ccb2a4ccfadea91ad26d900faef5e04ee41a2..aa097adc43267725367c6fea66e48bd4f3c6d932 100644 (file)
@@ -9,18 +9,14 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronVpnIpSecPolicy extends NeutronBaseAttributes<NeutronVpnIpSecPolicy> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronVpnIpSecPolicy.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -95,43 +91,28 @@ public final class NeutronVpnIpSecPolicy extends NeutronBaseAttributes<NeutronVp
         this.lifetime = lifetime;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them
-     * as a new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return a NeutronVpnIpSecPolicy object with only the selected fields
-     *             populated
-     */
-    public NeutronVpnIpSecPolicy extractFields(List<String> fields) {
-        NeutronVpnIpSecPolicy ans = new NeutronVpnIpSecPolicy();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "transform_protocol":
-                    ans.setTransformProtocol(this.getTransformProtocol());
-                    break;
-                case "encapsulation_mode":
-                    ans.setEncapsulationMode(this.getEncapsulationMode());
-                    break;
-                case "auth_algorithm":
-                    ans.setAuthAlgorithm(this.getAuthAlgorithm());
-                    break;
-                case "encryption_algorithm":
-                    ans.setEncryptionAlgorithm(this.getEncryptionAlgorithm());
-                    break;
-                case "pfs":
-                    ans.setPerfectForwardSecrecy(this.getPerfectForwardSecrecy());
-                    break;
-                default:
-                    LOGGER.warn("{} is not an NeutronVpnIpSecPolicy suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronVpnIpSecPolicy ans) {
+        switch (field) {
+            case "transform_protocol":
+                ans.setTransformProtocol(this.getTransformProtocol());
+                break;
+            case "encapsulation_mode":
+                ans.setEncapsulationMode(this.getEncapsulationMode());
+                break;
+            case "auth_algorithm":
+                ans.setAuthAlgorithm(this.getAuthAlgorithm());
+                break;
+            case "encryption_algorithm":
+                ans.setEncryptionAlgorithm(this.getEncryptionAlgorithm());
+                break;
+            case "pfs":
+                ans.setPerfectForwardSecrecy(this.getPerfectForwardSecrecy());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
 }
index a1928b0345778b87c85bdfdc412694cab92d6555..2555e23d3327e8c9014e56c20a0e654f2fbdc4b0 100644 (file)
@@ -14,14 +14,11 @@ import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronVpnIpSecSiteConnection extends NeutronAdminAttributes<NeutronVpnIpSecSiteConnection>
         implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronVpnIpSecSiteConnection.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -162,59 +159,43 @@ public final class NeutronVpnIpSecSiteConnection extends NeutronAdminAttributes<
         this.deadPeerDetection = deadPeerDetection;
     }
 
-    /**
-     * This method copies selected fields from the object and returns them as a
-     * new object, suitable for marshaling.
-     *
-     * @param fields
-     *            List of attributes to be extracted
-     * @return a NeutronVpnIpSecSiteConnection object with only the selected
-     *         fields populated
-     */
-
-    public NeutronVpnIpSecSiteConnection extractFields(List<String> fields) {
-        NeutronVpnIpSecSiteConnection ans = new NeutronVpnIpSecSiteConnection();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "peer_address":
-                    ans.setPeerAddress(this.getPeerAddress());
-                    break;
-                case "peer_id":
-                    ans.setPeerID(this.getPeerID());
-                    break;
-                case "route_mode":
-                    ans.setRouteMode(this.getRouteMode());
-                    break;
-                case "mtu":
-                    ans.setMtu(this.getMtu());
-                    break;
-                case "auth_mode":
-                    ans.setAuthMode(this.getAuthMode());
-                    break;
-                case "psk":
-                    ans.setPreSharedKey(this.getPreSharedKey());
-                    break;
-                case "initiator":
-                    ans.setInitiator(this.getInitiator());
-                    break;
-                case "ikepolicy_id":
-                    ans.setIkePolicyID(this.getIkePolicyID());
-                    break;
-                case "ipsecpolicy_id":
-                    ans.setIpsecPolicyID(this.getIpsecPolicyID());
-                    break;
-                case "vpnservice_id":
-                    ans.setVpnServiceID(this.getVpnServiceID());
-                    break;
-                default:
-                    LOGGER.warn("{} is not an NeutronVpnIpSecSiteConnection suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronVpnIpSecSiteConnection ans) {
+        switch (field) {
+            case "peer_address":
+                ans.setPeerAddress(this.getPeerAddress());
+                break;
+            case "peer_id":
+                ans.setPeerID(this.getPeerID());
+                break;
+            case "route_mode":
+                ans.setRouteMode(this.getRouteMode());
+                break;
+            case "mtu":
+                ans.setMtu(this.getMtu());
+                break;
+            case "auth_mode":
+                ans.setAuthMode(this.getAuthMode());
+                break;
+            case "psk":
+                ans.setPreSharedKey(this.getPreSharedKey());
+                break;
+            case "initiator":
+                ans.setInitiator(this.getInitiator());
+                break;
+            case "ikepolicy_id":
+                ans.setIkePolicyID(this.getIkePolicyID());
+                break;
+            case "ipsecpolicy_id":
+                ans.setIpsecPolicyID(this.getIpsecPolicyID());
+                break;
+            case "vpnservice_id":
+                ans.setVpnServiceID(this.getVpnServiceID());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
index 580593b0e96429649b7c83b7abc062f89025fb44..458300f80cabe3a6eb65a9a3370fffef51a8f4fc 100644 (file)
@@ -9,18 +9,14 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
 public final class NeutronVpnService extends NeutronAdminAttributes<NeutronVpnService> implements Serializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronVpnService.class);
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
@@ -51,24 +47,18 @@ public final class NeutronVpnService extends NeutronAdminAttributes<NeutronVpnSe
         this.subnetUUID = subnetUUID;
     }
 
-    public NeutronVpnService extractFields(List<String> fields) {
-        NeutronVpnService ans = new NeutronVpnService();
-        for (String s : fields) {
-            if (extractField(s, ans)) {
-                continue;
-            }
-            switch (s) {
-                case "router_id":
-                    ans.setRouterUUID(this.getRouterUUID());
-                    break;
-                case "subnet_id":
-                    ans.setSubnetUUID(this.getSubnetUUID());
-                    break;
-                default:
-                    LOGGER.warn("{} is not an NeutronVpnService suitable field.", s);
-                    break;
-            }
+    @Override
+    protected boolean extractField(String field, NeutronVpnService ans) {
+        switch (field) {
+            case "router_id":
+                ans.setRouterUUID(this.getRouterUUID());
+                break;
+            case "subnet_id":
+                ans.setSubnetUUID(this.getSubnetUUID());
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 }