*/
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;
public NeutronSFCFlowClassifier() {
}
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
public String getEthertype() {
return ethertype;
}
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 + ']';
}
}