|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.amazon.carbonado.qe.AbstractQuery<S>
public abstract class AbstractQuery<S extends Storable>
AbstractQuery implements a small set of common Query methods. Subclasses should consider overriding some of these methods, if it provides better performance.
| Constructor Summary | |
|---|---|
protected |
AbstractQuery()
|
| Method Summary | ||
|---|---|---|
Query<S> |
and(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,
Long to)
Called by sliced fetch to ensure that arguments are valid. |
|
void |
deleteOne()
Deletes one matching object. |
|
abstract boolean |
equals(Object obj)
|
|
|
fetchAfter(T start)
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. |
|
Query<S> |
or(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(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(Appendable app)
Prints the query excecution plan to any appendable, which is useful for performance analysis. |
|
String |
toString()
Implementation calls appendTo. |
|
S |
tryLoadOne()
May return null if nothing found. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.amazon.carbonado.Query |
|---|
after, and, count, deleteAll, exists, fetch, fetchSlice, getBlankParameterCount, getFilter, getFilterValues, getStorableType, not, or, orderBy, orderBy, printNative, printPlan, tryDeleteOne, with, with, with, with, with, with, with, with, with, withValues |
| Methods inherited from interface com.amazon.carbonado.util.Appender |
|---|
appendTo |
| Constructor Detail |
|---|
protected AbstractQuery()
| Method Detail |
|---|
public Query<S> and(String filter)
throws FetchException
Queryfilter logically "and"ed to this, potentially reducing the amount of
results.
and in interface Query<S extends Storable>filter - query filter expression
FetchException - if storage layer throws an exception
public Query<S> or(String filter)
throws FetchException
Queryfilter logically "or"ed to this, potentially increasing the amount of
results.
or in interface Query<S extends Storable>filter - query filter expression
FetchException - if storage layer throws an exception
public <T extends S> Cursor<S> fetchAfter(T start)
throws FetchException
Queryordering. 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 results
FetchException - 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 found
FetchMultipleException - if more than one matching record found
FetchException - if storage layer throws an exception
public S tryLoadOne()
throws FetchException
Query
tryLoadOne in interface Query<S extends Storable>FetchMultipleException - if more than one matching record found
FetchException - if storage layer throws an exception
public void deleteOne()
throws PersistException
Query
deleteOne in interface Query<S extends Storable>PersistNoneException - if no matching record found
PersistMultipleException - if more than one record matches
PersistException - if storage layer throws an exceptionpublic boolean printNative()
Query
printNative in interface Query<S extends Storable>
public boolean printNative(Appendable app)
throws IOException
Query
printNative in interface Query<S extends Storable>app - append results here
IOExceptionpublic boolean printPlan()
Query
printPlan in interface Query<S extends Storable>
public boolean printPlan(Appendable app)
throws IOException
Query
printPlan in interface Query<S extends Storable>app - append results here
IOExceptionpublic String toString()
toString in interface Query<S extends Storable>toString in class Objectpublic abstract int hashCode()
hashCode in interface Query<S extends Storable>hashCode in class Objectpublic abstract boolean equals(Object obj)
equals in interface Query<S extends Storable>equals in class Object
protected boolean checkSliceArguments(long from,
Long to)
IllegalArgumentException - if arguments are invalid
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||