1
19
20 package com.liferay.portal.kernel.util;
21
22 import java.util.Properties;
23
24 import javax.servlet.http.HttpServletRequest;
25
26
32 public class PropertiesParamUtil {
33
34 public static boolean getBoolean(
35 Properties props, HttpServletRequest request, String param) {
36
37 return getBoolean(props, request, param, GetterUtil.DEFAULT_BOOLEAN);
38 }
39
40 public static boolean getBoolean(
41 Properties props, HttpServletRequest request, String param,
42 boolean defaultValue) {
43
44 String propsValue = props.getProperty(param, null);
45
46 boolean getterUtilValue = GetterUtil.getBoolean(
47 propsValue, defaultValue);
48
49 return ParamUtil.get(request, param, getterUtilValue);
50 }
51
52 public static boolean getBoolean(
53 UnicodeProperties props, HttpServletRequest request, String param) {
54
55 return getBoolean(props, request, param, GetterUtil.DEFAULT_BOOLEAN);
56 }
57
58 public static boolean getBoolean(
59 UnicodeProperties props, HttpServletRequest request, String param,
60 boolean defaultValue) {
61
62 String propsValue = props.getProperty(param, null);
63
64 boolean getterUtilValue = GetterUtil.getBoolean(
65 propsValue, defaultValue);
66
67 return ParamUtil.get(request, param, getterUtilValue);
68 }
69
70 public static double getDouble(
71 Properties props, HttpServletRequest request, String param) {
72
73 return getDouble(props, request, param, GetterUtil.DEFAULT_DOUBLE);
74 }
75
76 public static double getDouble(
77 Properties props, HttpServletRequest request, String param,
78 double defaultValue) {
79
80 String propsValue = props.getProperty(param, null);
81
82 double getterUtilValue = GetterUtil.getDouble(
83 propsValue, defaultValue);
84
85 return ParamUtil.get(request, param, getterUtilValue);
86 }
87
88 public static double getDouble(
89 UnicodeProperties props, HttpServletRequest request, String param) {
90
91 return getDouble(props, request, param, GetterUtil.DEFAULT_DOUBLE);
92 }
93
94 public static double getDouble(
95 UnicodeProperties props, HttpServletRequest request, String param,
96 double defaultValue) {
97
98 String propsValue = props.getProperty(param, null);
99
100 double getterUtilValue = GetterUtil.getDouble(
101 propsValue, defaultValue);
102
103 return ParamUtil.get(request, param, getterUtilValue);
104 }
105
106 public static int getInteger(
107 Properties props, HttpServletRequest request, String param) {
108
109 return getInteger(props, request, param, GetterUtil.DEFAULT_INTEGER);
110 }
111
112 public static int getInteger(
113 Properties props, HttpServletRequest request, String param,
114 int defaultValue) {
115
116 String propsValue = props.getProperty(param, null);
117
118 int getterUtilValue = GetterUtil.getInteger(
119 propsValue, defaultValue);
120
121 return ParamUtil.get(request, param, getterUtilValue);
122 }
123
124 public static int getInteger(
125 UnicodeProperties props, HttpServletRequest request, String param) {
126
127 return getInteger(props, request, param, GetterUtil.DEFAULT_INTEGER);
128 }
129
130 public static int getInteger(
131 UnicodeProperties props, HttpServletRequest request, String param,
132 int defaultValue) {
133
134 String propsValue = props.getProperty(param, null);
135
136 int getterUtilValue = GetterUtil.getInteger(
137 propsValue, defaultValue);
138
139 return ParamUtil.get(request, param, getterUtilValue);
140 }
141
142 public static long getLong(
143 Properties props, HttpServletRequest request, String param) {
144
145 return getLong(props, request, param, GetterUtil.DEFAULT_LONG);
146 }
147
148 public static long getLong(
149 Properties props, HttpServletRequest request, String param,
150 long defaultValue) {
151
152 String propsValue = props.getProperty(param, null);
153
154 long getterUtilValue = GetterUtil.getLong(
155 propsValue, defaultValue);
156
157 return ParamUtil.get(request, param, getterUtilValue);
158 }
159
160 public static long getLong(
161 UnicodeProperties props, HttpServletRequest request, String param) {
162
163 return getLong(props, request, param, GetterUtil.DEFAULT_LONG);
164 }
165
166 public static long getLong(
167 UnicodeProperties props, HttpServletRequest request, String param,
168 long defaultValue) {
169
170 String propsValue = props.getProperty(param, null);
171
172 long getterUtilValue = GetterUtil.getLong(
173 propsValue, defaultValue);
174
175 return ParamUtil.get(request, param, getterUtilValue);
176 }
177
178 public static String getString(
179 Properties props, HttpServletRequest request, String param) {
180
181 return getString(props, request, param, GetterUtil.DEFAULT_STRING);
182 }
183
184 public static String getString(
185 Properties props, HttpServletRequest request, String param,
186 String defaultValue) {
187
188 String propsValue = props.getProperty(param, null);
189
190 String getterUtilValue = GetterUtil.getString(
191 propsValue, defaultValue);
192
193 return ParamUtil.get(request, param, getterUtilValue);
194 }
195
196 public static String getString(
197 UnicodeProperties props, HttpServletRequest request, String param) {
198
199 return getString(props, request, param, GetterUtil.DEFAULT_STRING);
200 }
201
202 public static String getString(
203 UnicodeProperties props, HttpServletRequest request, String param,
204 String defaultValue) {
205
206 String propsValue = props.getProperty(param, null);
207
208 String getterUtilValue = GetterUtil.getString(
209 propsValue, defaultValue);
210
211 return ParamUtil.get(request, param, getterUtilValue);
212 }
213
214 }