BUG-2218: Keep existing link augmentations during discovery process
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / core / Description.java
1 /*
2  * Copyright (c) 2014 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 package org.opendaylight.controller.sal.core;
9
10 import javax.xml.bind.annotation.XmlAccessType;
11 import javax.xml.bind.annotation.XmlAccessorType;
12 import javax.xml.bind.annotation.XmlElement;
13 import javax.xml.bind.annotation.XmlRootElement;
14
15 /**
16  * The class represents the Name property of an element.
17  */
18 @XmlRootElement
19 @SuppressWarnings("serial")
20 @XmlAccessorType(XmlAccessType.NONE)
21 public class Description extends Property {
22     @XmlElement(name="value")
23     private String descriptionValue;
24     public static final String propertyName = "description";
25
26     /*
27      * Private constructor used for JAXB mapping
28      */
29     private Description() {
30         super(propertyName);
31         this.descriptionValue = null;
32     }
33
34     public Description(String description) {
35         super(propertyName);
36         this.descriptionValue = description;
37     }
38
39     @Override
40     public Description clone() {
41         return new Description(this.descriptionValue);
42     }
43
44     public String getValue() {
45         return this.descriptionValue;
46     }
47
48     @Override
49     public int hashCode() {
50         final int prime = 31;
51         int result = super.hashCode();
52         result = prime * result
53                 + ((descriptionValue == null) ? 0 : descriptionValue.hashCode());
54         return result;
55     }
56
57     @Override
58     public boolean equals(Object obj) {
59         if (this == obj)
60             return true;
61         if (!super.equals(obj))
62             return false;
63         if (getClass() != obj.getClass())
64             return false;
65         Description other = (Description) obj;
66         if (descriptionValue == null) {
67             if (other.descriptionValue != null)
68                 return false;
69         } else if (!descriptionValue.equals(other.descriptionValue))
70             return false;
71         return true;
72     }
73
74     @Override
75     public String toString() {
76         return "Description[" + descriptionValue + "]";
77     }
78
79     @Override
80     public String getStringValue() {
81         return descriptionValue;
82     }
83 }