Merge "Implement cluster wide topology notifications and let routing use it"
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / core / Description.java
1 package org.opendaylight.controller.sal.core;
2
3 import javax.xml.bind.annotation.XmlElement;
4 import javax.xml.bind.annotation.XmlRootElement;
5
6 /**
7  * The class represents the Name property of an element.
8  */
9 @XmlRootElement
10 @SuppressWarnings("serial")
11 public class Description extends Property {
12     @XmlElement
13     private String descriptionValue;
14     public static final String propertyName = "description";
15
16     /*
17      * Private constructor used for JAXB mapping
18      */
19     private Description() {
20         super(propertyName);
21         this.descriptionValue = null;
22     }
23
24     public Description(String description) {
25         super(propertyName);
26         this.descriptionValue = description;
27     }
28
29     public Description clone() {
30         return new Description(this.descriptionValue);
31     }
32
33     public String getValue() {
34         return this.descriptionValue;
35     }
36
37     @Override
38     public int hashCode() {
39         final int prime = 31;
40         int result = super.hashCode();
41         result = prime * result
42                 + ((descriptionValue == null) ? 0 : descriptionValue.hashCode());
43         return result;
44     }
45
46     @Override
47     public boolean equals(Object obj) {
48         if (this == obj)
49             return true;
50         if (!super.equals(obj))
51             return false;
52         if (getClass() != obj.getClass())
53             return false;
54         Description other = (Description) obj;
55         if (descriptionValue == null) {
56             if (other.descriptionValue != null)
57                 return false;
58         } else if (!descriptionValue.equals(other.descriptionValue))
59             return false;
60         return true;
61     }
62
63     @Override
64     public String toString() {
65         return "Description[" + descriptionValue + "]";
66     }
67 }