1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.util;
17
18 import org.apache.commons.lang.NumberUtils;
19 import org.apache.commons.lang.StringUtils;
20 import org.kuali.rice.core.api.util.collect.CollectionUtils;
21
22 import java.util.Enumeration;
23
24
25
26
27
28
29
30 public final class PagingBannerUtils {
31
32
33 private PagingBannerUtils() {
34 throw new UnsupportedOperationException("do not call");
35 }
36
37
38
39
40
41
42
43
44
45 public static int getNumbericalValueAfterPrefix(String paramPrefix, Enumeration<String> parameterNames) {
46
47 for (String parameterName : CollectionUtils.toIterable(parameterNames)) {
48 if (parameterName.startsWith(paramPrefix)) {
49 parameterName = WebUtils.endsWithCoordinates(parameterName) ? parameterName : parameterName + ".x";
50 String numberStr = StringUtils.substringBetween(parameterName, paramPrefix, ".");
51 if (NumberUtils.isDigits(numberStr)) {
52 return Integer.parseInt(numberStr);
53 }
54 }
55 }
56
57 return -1;
58 }
59
60
61
62
63
64 public static String getStringValueAfterPrefix(String paramPrefix, Enumeration<String> parameterNames) {
65 for (String parameterName : CollectionUtils.toIterable(parameterNames)) {
66 if (parameterName.startsWith(paramPrefix)) {
67 parameterName = WebUtils.endsWithCoordinates(parameterName) ? parameterName : parameterName + ".x";
68 return StringUtils.substringBetween(parameterName, paramPrefix, ".");
69 }
70 }
71
72 return "";
73 }
74 }