diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-12-21 22:24:41 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-12-21 22:24:41 +0100 |
commit | a63ec924e5440b17434ecc91e84d1419ae39ef2a (patch) | |
tree | 933459602e0fcfd76a5f0d98d5465dc9f4aabed9 /src/main/java/io/trygvis/esper/testing/sql/SqlOption.java | |
parent | e7b1958ce5e93ead2d7d3c74eabe00a4186a048a (diff) | |
download | esper-testing-a63ec924e5440b17434ecc91e84d1419ae39ef2a.tar.gz esper-testing-a63ec924e5440b17434ecc91e84d1419ae39ef2a.tar.bz2 esper-testing-a63ec924e5440b17434ecc91e84d1419ae39ef2a.tar.xz esper-testing-a63ec924e5440b17434ecc91e84d1419ae39ef2a.zip |
o Adding a sequence number to jenkins_build.
o Making the table poller poll based on a sequence number instead.
Diffstat (limited to 'src/main/java/io/trygvis/esper/testing/sql/SqlOption.java')
-rw-r--r-- | src/main/java/io/trygvis/esper/testing/sql/SqlOption.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/sql/SqlOption.java b/src/main/java/io/trygvis/esper/testing/sql/SqlOption.java index 058435e..288735a 100644 --- a/src/main/java/io/trygvis/esper/testing/sql/SqlOption.java +++ b/src/main/java/io/trygvis/esper/testing/sql/SqlOption.java @@ -43,6 +43,16 @@ public abstract class SqlOption<A> { return !isSome(); } + public abstract A getOrElse(A a); + + public static <A> SqlOption<A> fromNull(A a) { + if (a != null) { + return some(a); + } else { + return none(); + } + } + // ----------------------------------------------------------------------- // // ----------------------------------------------------------------------- @@ -59,6 +69,14 @@ public abstract class SqlOption<A> { public boolean isSome() { return false; } + + public A getOrElse(A a) { + return a; + } + + public String toString() { + return "None"; + } } private static class Some<A> extends SqlOption<A> { @@ -79,5 +97,13 @@ public abstract class SqlOption<A> { public boolean isSome() { return true; } + + public A getOrElse(A a) { + return this.a; + } + + public String toString() { + return "Some(" + a + ")"; + } } } |