Fix FindBugs violations
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronSFCPortChain.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.neutron.spi;
9
10 import java.util.List;
11 import java.util.Map;
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
17
18 @XmlRootElement
19 @XmlAccessorType(XmlAccessType.NONE)
20 public final class NeutronSFCPortChain extends NeutronBaseAttributes<NeutronSFCPortChain> {
21     private static final long serialVersionUID = 1L;
22
23     // See OpenStack Networking SFC (networking-sfc) Port Chain API v1.0 Reference
24     // for description of annotated attributes
25
26     @XmlElement(name = "port_pair_groups")
27     List<String> portPairGroupsUUID;
28
29     @XmlElement(name = "flow_classifiers")
30     List<String> flowClassifiersUUID;
31
32     @XmlElement(name = "chain_parameters")
33     @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
34     Map<String, String> chainParameters;
35
36     public NeutronSFCPortChain() {
37     }
38
39     public List<String> getPortPairGroupsUUID() {
40         return portPairGroupsUUID;
41     }
42
43     public void setPortPairGroupsUUID(List<String> portPairGroupsUUID) {
44         this.portPairGroupsUUID = portPairGroupsUUID;
45     }
46
47     public List<String> getFlowClassifiersUUID() {
48         return flowClassifiersUUID;
49     }
50
51     public void setFlowClassifiersUUID(List<String> flowClassifiersUUID) {
52         this.flowClassifiersUUID = flowClassifiersUUID;
53     }
54
55     public Map<String, String> getChainParameters() {
56         return chainParameters;
57     }
58
59     public void setChainParameters(Map<String, String> chainParameters) {
60         this.chainParameters = chainParameters;
61     }
62
63     @Override
64     protected boolean extractField(String field, NeutronSFCPortChain ans) {
65         switch (field) {
66             case "port_pair_groups":
67                 ans.setPortPairGroupsUUID(this.getPortPairGroupsUUID());
68                 break;
69             case "flow_classifiers":
70                 ans.setFlowClassifiersUUID(this.getFlowClassifiersUUID());
71                 break;
72             case "chain_parameters":
73                 ans.setChainParameters(this.getChainParameters());
74                 break;
75             default:
76                 return super.extractField(field, ans);
77         }
78         return true;
79     }
80
81     @Override
82     public String toString() {
83         return "NeutronSFCPortChain[" + "tenantID='" + tenantID + '\'' + ", name='" + name + '\''
84                 + ", portPairGroupsUUID=" + portPairGroupsUUID + ", flowClassifiersUUID='" + flowClassifiersUUID + '\''
85                 + ", chainParameters=" + chainParameters + ']';
86     }
87 }