Fix FindBugs violations
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronSFCPortPair.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.HashMap;
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 NeutronSFCPortPair extends NeutronBaseAttributes<NeutronSFCPortPair> {
21     private static final long serialVersionUID = 1L;
22
23     // See OpenStack Networking SFC (networking-sfc) Port Pair API v1.0 Reference
24     // for description of annotated attributes
25     @XmlElement(name = "ingress")
26     String ingressPortUUID;
27
28     @XmlElement(name = "egress")
29     String egressPortUUID;
30
31     @XmlElement(name = "service_function_parameters")
32     @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
33     Map<String, String> serviceFunctionParameters;
34
35     public NeutronSFCPortPair() {
36     }
37
38     public String getIngressPortUUID() {
39         return ingressPortUUID;
40     }
41
42     public void setIngressPortUUID(String ingressPortUUID) {
43         this.ingressPortUUID = ingressPortUUID;
44     }
45
46     public String getEgressPortUUID() {
47         return egressPortUUID;
48     }
49
50     public void setEgressPortUUID(String egressPortUUID) {
51         this.egressPortUUID = egressPortUUID;
52     }
53
54     public Map<String, String> getServiceFunctionParameters() {
55         return serviceFunctionParameters;
56     }
57
58     public void setServiceFunctionParameters(Map<String, String> serviceFunctionParameters) {
59         this.serviceFunctionParameters = serviceFunctionParameters;
60     }
61
62     @Override
63     protected boolean extractField(String field, NeutronSFCPortPair ans) {
64         switch (field) {
65             case "ingress":
66                 ans.setIngressPortUUID(this.getIngressPortUUID());
67                 break;
68             case "egress":
69                 ans.setEgressPortUUID(this.getEgressPortUUID());
70                 break;
71             case "service_function_parameters":
72                 ans.setServiceFunctionParameters(new HashMap<>(this.getServiceFunctionParameters()));
73                 break;
74             default:
75                 return super.extractField(field, ans);
76         }
77         return true;
78     }
79
80     @Override
81     public String toString() {
82         return "NeutronSFCPortPair[" + "tenantID='" + tenantID + '\'' + ", name='" + name + '\'' + ", ingressPortUUID='"
83                 + ingressPortUUID + '\'' + ", egressPortUUID='" + egressPortUUID + '\'' + ", serviceFunctionParameters="
84                 + serviceFunctionParameters + ']';
85     }
86 }