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