View Javadoc

1   package test.crispy.example.model;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   public class SpecialTestClass {
7   
8   	private Map childs = new HashMap();
9   	private String name = null;
10  	private String description = null;
11  	
12  	public SpecialTestClass() { }
13  	public SpecialTestClass(String pvName) { name = pvName; }
14  	
15  	public void setName(String pvName) {name = pvName; }
16  	public String getName() { return name; }
17  	
18  	public String getDescription() { return description; }
19  	public void setDescription(String pvDescription) { description = pvDescription; }
20  	
21  	public Map getChilds() { return childs; }
22  	public void setChilds(Map pvChilds) { childs = pvChilds; }
23  	
24  	public int hashCode() {
25  		if (getName() == null) {
26  			return super.hashCode();
27  		} else {
28  			return getName().hashCode();
29  		}
30  	}
31  	
32  	public boolean equals(Object pvObj) { 
33  		if (pvObj == null) {
34  			return false;
35  		}
36  		else if (this.getClass().isAssignableFrom(pvObj.getClass()) == false) {
37  			return false;
38  		}
39  		else {
40  			return ((SpecialTestClass) pvObj).getName().equals(getName());
41  		}
42  	}
43  
44  }