Enhancement to switchmanager CLI commands to display all the properties of node and...
[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(name="value")
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     @Override
30     public Description clone() {
31         return new Description(this.descriptionValue);
32     }
33
34     public String getValue() {
35         return this.descriptionValue;
36     }
37
38     @Override
39     public int hashCode() {
40         final int prime = 31;
41         int result = super.hashCode();
42         result = prime * result
43                 + ((descriptionValue == null) ? 0 : descriptionValue.hashCode());
44         return result;
45     }
46
47     @Override
48     public boolean equals(Object obj) {
49         if (this == obj)
50             return true;
51         if (!super.equals(obj))
52             return false;
53         if (getClass() != obj.getClass())
54             return false;
55         Description other = (Description) obj;
56         if (descriptionValue == null) {
57             if (other.descriptionValue != null)
58                 return false;
59         } else if (!descriptionValue.equals(other.descriptionValue))
60             return false;
61         return true;
62     }
63
64     @Override
65     public String toString() {
66         return "Description[" + descriptionValue + "]";
67     }
68
69     @Override
70     public String getStringValue() {
71         return descriptionValue;
72     }
73 }