Fix FindBugs violations
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronLoadBalancer.java
1 /*
2  * Copyright (C) 2014 Red Hat, Inc.  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
9 package org.opendaylight.neutron.spi;
10
11 import javax.xml.bind.annotation.XmlAccessType;
12 import javax.xml.bind.annotation.XmlAccessorType;
13 import javax.xml.bind.annotation.XmlElement;
14 import javax.xml.bind.annotation.XmlRootElement;
15
16 /**
17  * OpenStack Neutron v2.0 Load Balancer as a service
18  * (LBaaS) bindings. See OpenStack Network API
19  * v2.0 Reference for description of  the fields:
20  * Implemented fields are as follows:
21  *
22  * <p>
23  * id                 uuid-str
24  * tenant_id          uuid-str
25  * name               String
26  * status             String
27  * vip_address        IP address
28  * vip_subnet         uuid-str
29  * http://docs.openstack.org/api/openstack-network/2.0/openstack-network.pdf
30  */
31
32 @XmlRootElement
33 @XmlAccessorType(XmlAccessType.NONE)
34 public final class NeutronLoadBalancer extends NeutronAdminAttributes<NeutronLoadBalancer> {
35     private static final long serialVersionUID = 1L;
36
37     @XmlElement(name = "vip_address")
38     String loadBalancerVipAddress;
39
40     @XmlElement(name = "vip_subnet_id")
41     String loadBalancerVipSubnetID;
42
43     public String getLoadBalancerVipAddress() {
44         return loadBalancerVipAddress;
45     }
46
47     public void setLoadBalancerVipAddress(String loadBalancerVipAddress) {
48         this.loadBalancerVipAddress = loadBalancerVipAddress;
49     }
50
51     public String getLoadBalancerVipSubnetID() {
52         return loadBalancerVipSubnetID;
53     }
54
55     public void setLoadBalancerVipSubnetID(String loadBalancerVipSubnetID) {
56         this.loadBalancerVipSubnetID = loadBalancerVipSubnetID;
57     }
58
59     @Override
60     protected boolean extractField(String field, NeutronLoadBalancer ans) {
61         switch (field) {
62             case "vip_address":
63                 ans.setLoadBalancerVipAddress(this.getLoadBalancerVipAddress());
64                 break;
65             case "vip_subnet_id":
66                 ans.setLoadBalancerVipSubnetID(this.getLoadBalancerVipSubnetID());
67                 break;
68             default:
69                 return super.extractField(field, ans);
70         }
71         return true;
72     }
73
74     @Override
75     public String toString() {
76         return "NeutronLoadBalancer{" + "loadBalancerID='" + uuid + '\'' + ", loadBalancerTenantID='" + tenantID + '\''
77                 + ", loadBalancerName='" + name + '\'' + ", loadBalancerStatus='" + status
78                 + '\'' + ", loadBalancerAdminStateUp='" + adminStateUp + '\'' + ", loadBalancerVipAddress='"
79                 + loadBalancerVipAddress + '\'' + ", loadBalancerVipSubnetID='" + loadBalancerVipSubnetID + '\'' + '}';
80     }
81 }