005e5fedafae338bb7304170802ab2d6ea7868c4
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / structures / YangElement.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.restconf.impl.test.structures;
9
10 public class YangElement {
11     protected String name;
12
13     protected YangElement(String name) {
14         this.name = name;
15     }
16
17     public String getName() {
18         return name;
19     }
20
21     @Override
22     public boolean equals(Object obj) {
23         if (this == obj) {
24             return true;
25         }
26         if (!this.getClass().equals(obj.getClass())) {
27             return false;
28         }
29         YangElement yangElement = (YangElement) obj;
30         if (this.name == null) {
31             if (yangElement.name != null) {
32                 return false;
33             }
34         } else if (!this.name.equals(yangElement.name)) {
35             return false;
36         }
37         return true;
38     }
39
40     @Override
41     public int hashCode() {
42         final int prime = 31;
43         int result = 1;
44         result = prime * result + ((name == null) ? 0 : name.hashCode());
45         return result;
46     }
47
48     @Override
49     public String toString() {
50         return name;
51     }
52
53 }