Fix checkstyle
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronBaseAttributes.java
1 /*
2  * Copyright (c) 2016 Intel Corporation  All rights reserved.
3  * Copyright (c) 2016 Isaku Yamahata  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.neutron.spi;
11
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
17 @XmlRootElement
18 @XmlAccessorType(XmlAccessType.NONE)
19 public abstract class NeutronBaseAttributes<T extends NeutronBaseAttributes<T>> extends NeutronObject<T>
20         implements INeutronBaseAttributes<T> {
21     private static final long serialVersionUID = 1L;
22
23     @XmlElement(name = "name")
24     String name;
25
26     public NeutronBaseAttributes() {
27     }
28
29     @Override
30     public String getName() {
31         return name;
32     }
33
34     @Override
35     public void setName(String name) {
36         this.name = name;
37     }
38
39     @Override
40     protected boolean extractField(String field, T ans) {
41         switch (field) {
42             case "name":
43                 ans.setName(this.getName());
44                 return true;
45             default:
46                 return super.extractField(field, ans);
47         }
48     }
49 }