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