View Javadoc

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