Test composite node with empty conts and lists to Json
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / structures / Lf.java
1 package org.opendaylight.controller.sal.restconf.impl.test.structures;
2
3 public class Lf extends YangElement {
4     private String value;
5     private int numOfEqualItems = 0;
6
7
8     public Lf(String name, String value) {
9         super(name);
10         this.value = value;
11     }
12
13     public Lf(String value) {
14         super("");
15         this.value = value;
16     }
17
18     public String getValue() {
19         return value;
20     }
21
22     @Override
23     public boolean equals(Object obj) {
24         if (this == obj) {
25             return true;
26         }
27         if (!this.getClass().equals(obj.getClass())) {
28             return false;
29         }
30         if (!super.equals(obj)) {
31             return false;
32         }
33         Lf lf = (Lf) obj;
34         if (this.value == null) {
35             if (lf.value != null) {
36                 return false;
37             }
38         } else if (!this.value.equals(lf.value)) {
39             return false;
40         }
41         if (this.numOfEqualItems != lf.numOfEqualItems) {
42             return false;
43         }
44         return true;
45     }
46     
47     public void incNumOfEqualItems() {
48         this.numOfEqualItems++;
49     }
50     
51
52     @Override
53     public int hashCode() {
54         final int prime = 31;
55         int result = super.hashCode();
56         result = prime * result + ((value == null) ? 0 : value.hashCode());
57         result = prime * result + numOfEqualItems;
58         return result;
59     }
60
61     @Override
62     public String toString() {
63         return super.toString() + ":" + value;
64     }
65
66 }