aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/trygvis/esper/testing/util/sql
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-12-26 13:30:42 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2012-12-26 13:30:42 +0100
commit348ec4e14aeaf4e98fcab96f0ae7242d178db69b (patch)
tree642b16e2fa6ffcfaf1429571d2f4771acc620e2e /src/main/java/io/trygvis/esper/testing/util/sql
parent97b1b1eeacd72845cc7065c86d68444881370275 (diff)
downloadesper-testing-348ec4e14aeaf4e98fcab96f0ae7242d178db69b.tar.gz
esper-testing-348ec4e14aeaf4e98fcab96f0ae7242d178db69b.tar.bz2
esper-testing-348ec4e14aeaf4e98fcab96f0ae7242d178db69b.tar.xz
esper-testing-348ec4e14aeaf4e98fcab96f0ae7242d178db69b.zip
o Starting on a better front page.
Diffstat (limited to 'src/main/java/io/trygvis/esper/testing/util/sql')
-rw-r--r--src/main/java/io/trygvis/esper/testing/util/sql/PageRequest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/util/sql/PageRequest.java b/src/main/java/io/trygvis/esper/testing/util/sql/PageRequest.java
new file mode 100644
index 0000000..2d8edfe
--- /dev/null
+++ b/src/main/java/io/trygvis/esper/testing/util/sql/PageRequest.java
@@ -0,0 +1,23 @@
+package io.trygvis.esper.testing.util.sql;
+
+import fj.data.*;
+import static fj.data.Option.fromNull;
+import io.trygvis.esper.testing.*;
+
+import javax.servlet.http.*;
+
+public class PageRequest {
+ public final Option<Integer> startIndex;
+ public final Option<Integer> count;
+
+ public PageRequest(Option<Integer> startIndex, Option<Integer> count) {
+ this.startIndex = startIndex;
+ this.count = count;
+ }
+
+ public static PageRequest fromReq(HttpServletRequest req) {
+ return new PageRequest(
+ fromNull(req.getParameter("startIndex")).bind(Util.parseInt),
+ fromNull(req.getParameter("count")).bind(Util.parseInt));
+ }
+}