Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SearchParam |
|
| 3.375;3.375 |
1 | /** | |
2 | * Copyright 2010 The Kuali Foundation Licensed under the | |
3 | * Educational Community License, Version 2.0 (the "License"); you may | |
4 | * not use this file except in compliance with the License. You may | |
5 | * obtain a copy of the License at | |
6 | * | |
7 | * http://www.osedu.org/licenses/ECL-2.0 | |
8 | * | |
9 | * Unless required by applicable law or agreed to in writing, | |
10 | * software distributed under the License is distributed on an "AS IS" | |
11 | * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |
12 | * or implied. See the License for the specific language governing | |
13 | * permissions and limitations under the License. | |
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 | 0 | 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 | 0 | if (value != null) { |
37 | 0 | return value; |
38 | } else { | |
39 | 0 | return listValue; |
40 | } | |
41 | } | |
42 | ||
43 | public void setValue(String value) { | |
44 | 0 | this.value = value; |
45 | 0 | listValue = null; |
46 | 0 | } |
47 | ||
48 | public void setValue(List<String> listValue) { | |
49 | 0 | this.listValue = listValue; |
50 | 0 | value = null; |
51 | 0 | } |
52 | ||
53 | public String getKey() { | |
54 | 0 | return key; |
55 | } | |
56 | ||
57 | public void setKey(String key) { | |
58 | 0 | this.key = key; |
59 | 0 | } |
60 | ||
61 | @Override | |
62 | public String toString() { | |
63 | 0 | return "SearchParam[key=" + key + ", value=" + value + ", listValue=" |
64 | + listValue + "]"; | |
65 | } | |
66 | ||
67 | @Override | |
68 | public boolean equals(Object o) { | |
69 | 0 | if (this == o) return true; |
70 | 0 | if (o == null || getClass() != o.getClass()) return false; |
71 | ||
72 | 0 | SearchParam that = (SearchParam) o; |
73 | ||
74 | 0 | if (key != null ? !key.equals(that.key) : that.key != null) return false; |
75 | 0 | if (listValue != null ? !listValue.equals(that.listValue) : that.listValue != null) return false; |
76 | 0 | if (value != null ? !value.equals(that.value) : that.value != null) return false; |
77 | ||
78 | 0 | return true; |
79 | } | |
80 | ||
81 | @Override | |
82 | public int hashCode() { | |
83 | 0 | int result = value != null ? value.hashCode() : 0; |
84 | 0 | result = 31 * result + (listValue != null ? listValue.hashCode() : 0); |
85 | 0 | result = 31 * result + (key != null ? key.hashCode() : 0); |
86 | 0 | return result; |
87 | } | |
88 | } |