1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.core.search.dto;
17
18 import java.io.Serializable;
19 import java.util.List;
20
21 import javax.xml.bind.annotation.XmlAccessType;
22 import javax.xml.bind.annotation.XmlAccessorType;
23 import javax.xml.bind.annotation.XmlAttribute;
24 import javax.xml.bind.annotation.XmlElement;
25 @XmlAccessorType(XmlAccessType.FIELD)
26 public class SearchParam implements Serializable {
27 private static final long serialVersionUID = 1L;
28 @XmlElement
29 private String value;
30 @XmlElement
31 private List<String> listValue;
32 @XmlAttribute
33 private String key;
34
35 public Object getValue() {
36 if (value != null) {
37 return value;
38 } else {
39 return listValue;
40 }
41 }
42
43 public void setValue(String value) {
44 this.value = value;
45 listValue = null;
46 }
47
48 public void setValue(List<String> listValue) {
49 this.listValue = listValue;
50 value = null;
51 }
52
53 public String getKey() {
54 return key;
55 }
56
57 public void setKey(String key) {
58 this.key = key;
59 }
60
61 @Override
62 public String toString() {
63 return "SearchParam[key=" + key + ", value=" + value + ", listValue="
64 + listValue + "]";
65 }
66
67 @Override
68 public boolean equals(Object o) {
69 if (this == o) return true;
70 if (o == null || getClass() != o.getClass()) return false;
71
72 SearchParam that = (SearchParam) o;
73
74 if (key != null ? !key.equals(that.key) : that.key != null) return false;
75 if (listValue != null ? !listValue.equals(that.listValue) : that.listValue != null) return false;
76 if (value != null ? !value.equals(that.value) : that.value != null) return false;
77
78 return true;
79 }
80
81 @Override
82 public int hashCode() {
83 int result = value != null ? value.hashCode() : 0;
84 result = 31 * result + (listValue != null ? listValue.hashCode() : 0);
85 result = 31 * result + (key != null ? key.hashCode() : 0);
86 return result;
87 }
88 }