| 1 | |
package org.kuali.student.lum.common.client.widgets; |
| 2 | |
|
| 3 | |
import org.kuali.student.common.assembly.data.Data; |
| 4 | |
import org.kuali.student.common.assembly.helper.PropertyEnum; |
| 5 | |
|
| 6 | |
public class QueryParamHelper { |
| 7 | |
|
| 8 | 0 | public enum Properties implements PropertyEnum |
| 9 | |
{ |
| 10 | 0 | VALUE ("value"), |
| 11 | 0 | LIST_VALUE ("listValue"), |
| 12 | 0 | KEY ("key"); |
| 13 | |
|
| 14 | |
private final String key; |
| 15 | |
|
| 16 | 0 | private Properties (final String key) { |
| 17 | 0 | this.key = key; |
| 18 | 0 | } |
| 19 | |
|
| 20 | |
@Override |
| 21 | |
public String getKey() { |
| 22 | 0 | return this.key; |
| 23 | |
} |
| 24 | |
} |
| 25 | |
|
| 26 | |
private Data data; |
| 27 | |
|
| 28 | 0 | public QueryParamHelper(Data data) { |
| 29 | 0 | this.data = data; |
| 30 | 0 | } |
| 31 | |
|
| 32 | |
public static QueryParamHelper wrap(Data data) { |
| 33 | 0 | if (data == null) { |
| 34 | 0 | return null; |
| 35 | |
} |
| 36 | 0 | return new QueryParamHelper(data); |
| 37 | |
} |
| 38 | |
|
| 39 | |
public void setValue(String value) { |
| 40 | 0 | data.set(Properties.VALUE.getKey(), value); |
| 41 | 0 | } |
| 42 | |
|
| 43 | |
public String getValue() { |
| 44 | 0 | return (String) data.get(Properties.VALUE.getKey()); |
| 45 | |
} |
| 46 | |
|
| 47 | |
public void setListValue(Data value) { |
| 48 | 0 | data.set(Properties.LIST_VALUE.getKey(), value); |
| 49 | 0 | } |
| 50 | |
|
| 51 | |
public Data getListValue() { |
| 52 | 0 | Data listValue = data.get(Properties.LIST_VALUE.getKey()); |
| 53 | 0 | if (listValue == null) { |
| 54 | 0 | listValue = new Data(); |
| 55 | 0 | setListValue(listValue); |
| 56 | |
} |
| 57 | 0 | return listValue; |
| 58 | |
} |
| 59 | |
|
| 60 | |
public void setKey(String value) { |
| 61 | 0 | data.set(Properties.KEY.getKey(), value); |
| 62 | 0 | } |
| 63 | |
|
| 64 | |
public String getKey() { |
| 65 | 0 | return (String) data.get(Properties.KEY.getKey()); |
| 66 | |
} |
| 67 | |
|
| 68 | |
public Data getData() { |
| 69 | 0 | return data; |
| 70 | |
} |
| 71 | |
|
| 72 | |
} |