Merge "Refactored yang-maven-plugin. Updated tests. Removed backup files."
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / core / Property.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  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.controller.sal.core;
11
12 import java.io.Serializable;
13
14 import javax.xml.bind.annotation.XmlRootElement;
15 import javax.xml.bind.annotation.XmlSeeAlso;
16
17 /**
18  * @file   Property.java
19  *
20  * @brief  Abstract base class for a Property that can be attached to
21  * any sal core element
22  *
23  * Abstract base class for a Property that can be attached to any sal
24  * core element
25  */
26
27 /**
28  * Abstract base class for a Property that can be attached to any sal
29  * core element
30  *
31  */
32 @XmlRootElement
33 @XmlSeeAlso({ Config.class, Name.class, State.class, TimeStamp.class,
34                 Latency.class, Bandwidth.class, Tier.class, Actions.class,
35                 AdvertisedBandwidth.class, Buffers.class, Capabilities.class,
36                 MacAddress.class, PeerBandwidth.class, SupportedBandwidth.class,
37                 Tables.class })
38 abstract public class Property implements Serializable {
39     private static final long serialVersionUID = 1L;
40     private String name;
41
42     /**
43      * Private constructor used for JAXB mapping
44      */
45     @SuppressWarnings("unused")
46     private Property() {
47         this.name = null;
48     }
49
50     protected Property(String name) {
51         this.name = name;
52     }
53
54     public String getName() {
55         return this.name;
56     }
57
58     /**
59      * Used to copy the Property in a polymorphic way
60      *
61      *
62      * @return A clone of this Property
63      */
64     abstract public Property clone();
65
66     @Override
67     public int hashCode() {
68         final int prime = 31;
69         int result = 1;
70         result = prime * result + ((name == null) ? 0 : name.hashCode());
71         return result;
72     }
73
74     @Override
75     public boolean equals(Object obj) {
76         if (this == obj)
77             return true;
78         if (obj == null)
79             return false;
80         if (getClass() != obj.getClass())
81             return false;
82         Property other = (Property) obj;
83         if (name == null) {
84             if (other.name != null)
85                 return false;
86         } else if (!name.equals(other.name))
87             return false;
88         return true;
89     }
90
91     @Override
92     public String toString() {
93         return "Property [name=" + name + "]";
94     }
95 }