From 675c72f1e6819e75aff99dd140c83a93b5372026 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Sat, 19 Apr 2008 21:12:07 +0000 Subject: Moved fetchAfter implementation to AbstractQuery. --- src/main/java/com/amazon/carbonado/Query.java | 3 +++ src/main/java/com/amazon/carbonado/qe/AbstractQuery.java | 4 ++++ src/main/java/com/amazon/carbonado/qe/EmptyQuery.java | 7 ------- src/main/java/com/amazon/carbonado/qe/StandardQuery.java | 4 ---- 4 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/amazon/carbonado/Query.java b/src/main/java/com/amazon/carbonado/Query.java index 0636655..3c3e6e2 100644 --- a/src/main/java/com/amazon/carbonado/Query.java +++ b/src/main/java/com/amazon/carbonado/Query.java @@ -313,6 +313,9 @@ public interface Query { * query needs to perform a sort operation. Ideally, the query ordering * should match the natural ordering of an index or key. * + *

Calling {@code fetchAfter(s)} is equivalent to calling {@code + * after(s).fetch()}. + * * @param start storable to attempt to start after; if null, fetch all results * @return fetch results * @throws IllegalStateException if any blank parameters in this query diff --git a/src/main/java/com/amazon/carbonado/qe/AbstractQuery.java b/src/main/java/com/amazon/carbonado/qe/AbstractQuery.java index 767b039..bd27d9a 100644 --- a/src/main/java/com/amazon/carbonado/qe/AbstractQuery.java +++ b/src/main/java/com/amazon/carbonado/qe/AbstractQuery.java @@ -53,6 +53,10 @@ public abstract class AbstractQuery implements Query, App return or(Filter.filterFor(getStorableType(), filter)); } + public Cursor fetchAfter(S start) throws FetchException { + return after(start).fetch(); + } + public S loadOne() throws FetchException { S obj = tryLoadOne(); if (obj == null) { diff --git a/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java b/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java index f34500d..0ddc561 100644 --- a/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java +++ b/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java @@ -224,13 +224,6 @@ public final class EmptyQuery extends AbstractQuery { return EmptyCursor.the(); } - /** - * Always returns an {@link EmptyCursor}. - */ - public Cursor fetchAfter(S start) { - return EmptyCursor.the(); - } - /** * Always throws {@link PersistNoneException}. */ diff --git a/src/main/java/com/amazon/carbonado/qe/StandardQuery.java b/src/main/java/com/amazon/carbonado/qe/StandardQuery.java index 71ad1e6..1bb03be 100644 --- a/src/main/java/com/amazon/carbonado/qe/StandardQuery.java +++ b/src/main/java/com/amazon/carbonado/qe/StandardQuery.java @@ -275,10 +275,6 @@ public abstract class StandardQuery extends AbstractQuery } } - public Cursor fetchAfter(S start) throws FetchException { - return after(start).fetch(); - } - public boolean tryDeleteOne() throws PersistException { Transaction txn = enterTransaction(IsolationLevel.READ_COMMITTED); try { -- cgit v1.2.3