Merge "Code cleanup: ternary operator."
[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 java.io.Serializable;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
17
18 @XmlRootElement
19 @XmlAccessorType(XmlAccessType.NONE)
20 public abstract class NeutronBaseAttributes<T extends NeutronBaseAttributes> extends NeutronObject<T>
21         implements Serializable, INeutronBaseAttributes<T> {
22     private static final long serialVersionUID = 1L;
23
24     @XmlElement(name = "name")
25     String name;
26
27     public NeutronBaseAttributes() {
28         super();
29     }
30
31     @Override
32     public String getName() {
33         return name;
34     }
35
36     @Override
37     public void setName(String name) {
38         this.name = name;
39     }
40
41     @Override
42     protected void extractField(String field, T ans) {
43         super.extractField(field, ans);
44         if (field.equals("name")) {
45             ans.setName(this.getName());
46         }
47     }
48 }