1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.common.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
28 private static final long serialVersionUID = 1L;
29 @XmlElement
30 private String value;
31 @XmlElement
32 private List<String> listValue;
33 @XmlAttribute
34 private String key;
35
36 public SearchParam(){
37 super();
38 }
39
40 public SearchParam(String key, String value) {
41 this();
42 this.key = key;
43 this.value = value;
44 }
45
46 public SearchParam(String key, List<String> value) {
47 this();
48 this.key = key;
49 this.listValue = value;
50 }
51
52
53 public Object getValue() {
54 if (value != null) {
55 return value;
56 } else {
57 return listValue;
58 }
59 }
60
61 public void setValue(String value) {
62 this.value = value;
63 listValue = null;
64 }
65
66 public void setValue(List<String> listValue) {
67 this.listValue = listValue;
68 value = null;
69 }
70
71 public String getKey() {
72 return key;
73 }
74
75 public void setKey(String key) {
76 this.key = key;
77 }
78
79 @Override
80 public String toString() {
81 return "SearchParam[key=" + key + ", value=" + value + ", listValue="
82 + listValue + "]";
83 }
84
85 @Override
86 public boolean equals(Object o) {
87 if (this == o) return true;
88 if (o == null || getClass() != o.getClass()) return false;
89
90 SearchParam that = (SearchParam) o;
91
92 if (key != null ? !key.equals(that.key) : that.key != null) return false;
93 if (listValue != null ? !listValue.equals(that.listValue) : that.listValue != null) return false;
94 if (value != null ? !value.equals(that.value) : that.value != null) return false;
95
96 return true;
97 }
98
99 @Override
100 public int hashCode() {
101 int result = value != null ? value.hashCode() : 0;
102 result = 31 * result + (listValue != null ? listValue.hashCode() : 0);
103 result = 31 * result + (key != null ? key.hashCode() : 0);
104 return result;
105 }
106 }