View Javadoc

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