public abstract class AbstractQuery<S extends Storable> extends java.lang.Object implements Query<S>, Appender
Query.Controller, Query.Timeout
Modifier | Constructor and Description |
---|---|
protected |
AbstractQuery() |
Modifier and Type | Method and Description |
---|---|
Query<S> |
and(java.lang.String filter)
Returns a new query which has another
filter logically "and"ed to this, potentially reducing the amount of
results. |
protected boolean |
checkSliceArguments(long from,
java.lang.Long to)
Called by sliced fetch to ensure that arguments are valid.
|
void |
deleteOne()
Deletes one matching object.
|
void |
deleteOne(Query.Controller controller)
Deletes one matching object.
|
abstract boolean |
equals(java.lang.Object obj) |
<T extends S> |
fetchAfter(T start)
Fetches results for this query after a given starting point, which is
useful for re-opening a cursor.
|
<T extends S> |
fetchAfter(T start,
Query.Controller controller)
Fetches results for this query after a given starting point, which is
useful for re-opening a cursor.
|
abstract int |
hashCode() |
S |
loadOne()
Attempts to load exactly one matching object.
|
S |
loadOne(Query.Controller controller)
Attempts to load exactly one matching object.
|
Query<S> |
or(java.lang.String filter)
Returns a new query which has another
filter logically "or"ed to this, potentially increasing the amount of
results. |
boolean |
printNative()
Print the native query to standard out, which is useful for performance
analysis.
|
boolean |
printNative(java.lang.Appendable app)
Prints the native query to any appendable, which is useful for
performance analysis.
|
boolean |
printPlan()
Prints the query excecution plan to standard out, which is useful for
performance analysis.
|
boolean |
printPlan(java.lang.Appendable app)
Prints the query excecution plan to any appendable, which is useful for
performance analysis.
|
java.lang.String |
toString()
Implementation calls appendTo.
|
S |
tryLoadOne()
Tries to load one record, but returns null if nothing was found.
|
S |
tryLoadOne(Query.Controller controller)
Tries to load one record, but returns null if nothing was found.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
after, and, count, count, deleteAll, deleteAll, exists, exists, fetch, fetch, fetchSlice, fetchSlice, getBlankParameterCount, getFilter, getFilterValues, getStorableType, not, or, orderBy, orderBy, printNative, printPlan, tryDeleteOne, tryDeleteOne, with, with, with, with, with, with, with, with, with, withValues
public Query<S> and(java.lang.String filter) throws FetchException
Query
filter
logically "and"ed to this, potentially reducing the amount of
results.and
in interface Query<S extends Storable>
filter
- query filter expressionFetchException
- if storage layer throws an exceptionpublic Query<S> or(java.lang.String filter) throws FetchException
Query
filter
logically "or"ed to this, potentially increasing the amount of
results.or
in interface Query<S extends Storable>
filter
- query filter expressionFetchException
- if storage layer throws an exceptionpublic <T extends S> Cursor<S> fetchAfter(T start) throws FetchException
Query
ordering
. If not a total
ordering, then cursor may start at an earlier position.
Note: This method can be very expensive to call repeatedly, if the query needs to perform a sort operation. Ideally, the query ordering should match the natural ordering of an index or key.
Calling fetchAfter(s)
is equivalent to calling after(s).fetch()
.
fetchAfter
in interface Query<S extends Storable>
start
- storable to attempt to start after; if null, fetch all resultsFetchException
- if storage layer throws an exceptionRepository.enterTransaction(IsolationLevel)
,
Query.after(T)
public <T extends S> Cursor<S> fetchAfter(T start, Query.Controller controller) throws FetchException
Query
ordering
. If not a total
ordering, then cursor may start at an earlier position.
Note: This method can be very expensive to call repeatedly, if the query needs to perform a sort operation. Ideally, the query ordering should match the natural ordering of an index or key.
Calling fetchAfter(s)
is equivalent to calling after(s).fetch()
.
fetchAfter
in interface Query<S extends Storable>
start
- storable to attempt to start after; if null, fetch all resultscontroller
- optional controller which can abort query operationFetchException
- if storage layer throws an exceptionRepository.enterTransaction(IsolationLevel)
,
Query.after(T)
public S loadOne() throws FetchException
Query
loadOne
in interface Query<S extends Storable>
FetchNoneException
- if no matching record foundFetchMultipleException
- if more than one matching record foundFetchException
- if storage layer throws an exceptionpublic S loadOne(Query.Controller controller) throws FetchException
Query
loadOne
in interface Query<S extends Storable>
controller
- optional controller which can abort query operationFetchNoneException
- if no matching record foundFetchMultipleException
- if more than one matching record foundFetchException
- if storage layer throws an exceptionpublic S tryLoadOne() throws FetchException
Query
tryLoadOne
in interface Query<S extends Storable>
FetchMultipleException
- if more than one matching record foundFetchException
- if storage layer throws an exceptionpublic S tryLoadOne(Query.Controller controller) throws FetchException
Query
tryLoadOne
in interface Query<S extends Storable>
controller
- optional controller which can abort query operationFetchMultipleException
- if more than one matching record foundFetchException
- if storage layer throws an exceptionpublic void deleteOne() throws PersistException
Query
deleteOne
in interface Query<S extends Storable>
PersistNoneException
- if no matching record foundPersistMultipleException
- if more than one record matchesPersistException
- if storage layer throws an exceptionpublic void deleteOne(Query.Controller controller) throws PersistException
Query
deleteOne
in interface Query<S extends Storable>
controller
- optional controller which can abort query operationPersistNoneException
- if no matching record foundPersistMultipleException
- if more than one record matchesPersistException
- if storage layer throws an exceptionpublic boolean printNative()
Query
printNative
in interface Query<S extends Storable>
public boolean printNative(java.lang.Appendable app) throws java.io.IOException
Query
printNative
in interface Query<S extends Storable>
app
- append results herejava.io.IOException
public boolean printPlan()
Query
public boolean printPlan(java.lang.Appendable app) throws java.io.IOException
Query
public java.lang.String toString()
public abstract int hashCode()
public abstract boolean equals(java.lang.Object obj)
protected boolean checkSliceArguments(long from, java.lang.Long to)
java.lang.IllegalArgumentException
- if arguments are invalidCopyright © 2006-2013 Amazon Technologies, Inc.. All Rights Reserved.