Bump upstreams for Silicon
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronSFCFlowClassifier.java
index 28b6f00ada8538c278ed5d0b193fe518243808a1..9e01a1db8a9d601d3ed23ab577b4d83914ff1a4d 100644 (file)
@@ -7,28 +7,21 @@
  */
 package org.opendaylight.neutron.spi;
 
+import java.util.HashMap;
+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 java.io.Serializable;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
-
-public class NeutronSFCFlowClassifier extends NeutronObject implements Serializable, INeutronObject {
+public final class NeutronSFCFlowClassifier extends NeutronBaseAttributes<NeutronSFCFlowClassifier> {
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Networking SFC (networking-sfc) API v1.0 Reference for description of
     // annotated attributes
-    @XmlElement(name = "name")
-    String name;
-
     @XmlElement(defaultValue = "IPv4", name = "ethertype")
     String ethertype;
 
@@ -66,14 +59,6 @@ public class NeutronSFCFlowClassifier extends NeutronObject implements Serializa
     public NeutronSFCFlowClassifier() {
     }
 
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
     public String getEthertype() {
         return ethertype;
     }
@@ -162,78 +147,53 @@ public class NeutronSFCFlowClassifier extends NeutronObject implements Serializa
         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();
-        Iterator<String> i = fields.iterator();
-        while (i.hasNext()) {
-            String s = i.next();
-            if (s.equals("id")) {
-                ans.setID(this.getID());
-            }
-            if (s.equals("tenant_id")) {
-                ans.setTenantID(this.getTenantID());
-            }
-            if (s.equals("name")) {
-                ans.setName(this.getName());
-            }
-            if (s.equals("ethertype")) {
+    @Override
+    protected boolean extractField(String field, NeutronSFCFlowClassifier ans) {
+        switch (field) {
+            case "ethertype":
                 ans.setEthertype(this.getEthertype());
-            }
-            if (s.equals("source_port_range_min")) {
+                break;
+            case "source_port_range_min":
                 ans.setSourcePortRangeMin(this.getSourcePortRangeMin());
-            }
-            if (s.equals("source_port_range_max")) {
+                break;
+            case "source_port_range_max":
                 ans.setSourcePortRangeMax(this.getSourcePortRangeMax());
-            }
-            if (s.equals("destination_port_range_min")) {
+                break;
+            case "destination_port_range_min":
                 ans.setDestinationPortRangeMin(this.getDestinationPortRangeMin());
-            }
-            if (s.equals("destination_port_range_max")) {
+                break;
+            case "destination_port_range_max":
                 ans.setDestinationPortRangeMax(this.getDestinationPortRangeMax());
-            }
-            if (s.equals("source_ip_prefix")) {
+                break;
+            case "source_ip_prefix":
                 ans.setSourceIpPrefix(this.getSourceIpPrefix());
-            }
-            if (s.equals("destination_ip_prefix")) {
+                break;
+            case "destination_ip_prefix":
                 ans.setDestinationIpPrefix(this.getDestinationIpPrefix());
-            }
-            if (s.equals("logical_source_port")) {
-                ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
-            }
-            if (s.equals("logical_destination_port")) {
+                break;
+            case "logical_source_port":
+                ans.setLogicalSourcePortUUID(this.getLogicalSourcePortUUID());
+                break;
+            case "logical_destination_port":
                 ans.setLogicalDestinationPortUUID(this.getLogicalDestinationPortUUID());
-            }
-            if (s.equals("l7_parameters")) {
-                ans.setL7Parameters(new HashMap<String, String>(this.getL7Parameters()));
-            }
+                break;
+            case "l7_parameters":
+                ans.setL7Parameters(new HashMap<>(this.getL7Parameters()));
+                break;
+            default:
+                return super.extractField(field, ans);
         }
-        return ans;
+        return true;
     }
 
     @Override
     public String toString() {
-        return "NeutronSFCFlowClassifier[" +
-                "name='" + name + '\'' +
-                ", ethertype='" + ethertype + '\'' +
-                ", protocol='" + protocol + '\'' +
-                ", sourcePortRangeMin=" + sourcePortRangeMin +
-                ", sourcePortRangeMax=" + sourcePortRangeMax +
-                ", destinationPortRangeMin=" + destinationPortRangeMin +
-                ", destinationPortRangeMax=" + destinationPortRangeMax +
-                ", sourceIpPrefix='" + sourceIpPrefix + '\'' +
-                ", destinationIpPrefix='" + destinationIpPrefix + '\'' +
-                ", logicalSourcePortUUID='" + logicalSourcePortUUID + '\'' +
-                ", logicalDestinationPortUUID='" + logicalDestinationPortUUID + '\'' +
-                ", l7Parameters=" + l7Parameters +
-                ']';
+        return "NeutronSFCFlowClassifier[" + "name='" + name + '\'' + ", ethertype='" + ethertype + '\''
+                + ", protocol='" + protocol + '\'' + ", sourcePortRangeMin=" + sourcePortRangeMin
+                + ", sourcePortRangeMax=" + sourcePortRangeMax + ", destinationPortRangeMin=" + destinationPortRangeMin
+                + ", destinationPortRangeMax=" + destinationPortRangeMax + ", sourceIpPrefix='" + sourceIpPrefix + '\''
+                + ", destinationIpPrefix='" + destinationIpPrefix + '\'' + ", logicalSourcePortUUID='"
+                + logicalSourcePortUUID + '\'' + ", logicalDestinationPortUUID='" + logicalDestinationPortUUID + '\''
+                + ", l7Parameters=" + l7Parameters + ']';
     }
 }