Yang and XML conversion to Json test with equals
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / structures / LstItem.java
1 package org.opendaylight.controller.sal.restconf.impl.test.structures;
2
3 import java.util.*;
4
5 public class LstItem {
6     String lstName;
7     Map<String, Lf> lfs;
8     Map<String, LfLst> lfLsts;
9     Map<String, Lst> lsts;
10     Map<String, Cont> conts;
11
12     public LstItem() {
13         lfs = new HashMap<>();
14         conts = new HashMap<>();
15         lfLsts = new HashMap<>();
16         lsts = new HashMap<>();
17     }
18
19     public Map<String, Lst> getLsts() {
20         return lsts;
21     }
22
23     public Map<String, Cont> getConts() {
24         return conts;
25     }
26
27     public Map<String, LfLst> getLfLsts() {
28         return lfLsts;
29     }
30
31     public Map<String, Lf> getLfs() {
32         return lfs;
33     }
34
35     public String getLstName() {
36         return lstName;
37     }
38
39     public LstItem addLf(Lf lf) {
40         lfs.put(lf.getName(), lf);
41         return this;
42     }
43
44     public void addLfLst(LfLst lfLst) {
45         lfLsts.put(lfLst.getName(), lfLst);
46     }
47
48     public void addLst(Lst lst) {
49         lsts.put(lst.getName(), lst);
50     }
51
52     public void addCont(Cont cont) {
53         conts.put(cont.getName(), cont);
54     }
55
56     @Override
57     public boolean equals(Object obj) {
58         if (this == obj) {
59             return true;
60         }
61         if (!this.getClass().equals(obj.getClass())) {
62             return false;
63         }
64         LstItem lstItem = (LstItem) obj;
65         if (!this.conts.equals(lstItem.conts)) {
66             return false;
67         }
68         if (!this.lfs.equals(lstItem.lfs)) {
69             return false;
70         }
71         if (!this.lfLsts.equals(lstItem.lfLsts)) {
72             return false;
73         }
74         if (!this.lsts.equals(lstItem.lsts)) {
75             return false;
76         }
77         return true;
78     }
79
80     @Override
81     public int hashCode() {
82         final int prime = 31;
83         int result = 1;
84         result = prime * result + ((lfs == null) ? 0 : lfs.hashCode());
85         result = prime * result + ((lfLsts == null) ? 0 : lfLsts.hashCode());
86         result = prime * result + ((lsts == null) ? 0 : lsts.hashCode());
87         result = prime * result + ((conts == null) ? 0 : conts.hashCode());
88         return result;
89     }
90
91     @Override
92     public String toString() {
93         return "lst item of " + lstName;
94     }
95
96     public void setLstName(String name) {
97         this.lstName = name;
98     }
99
100 }