|
exedio cope | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.exedio.cope.Query<R>
public final class Query<R>
| Nested Class Summary | |
|---|---|
static class |
Query.Result<R>
|
| Constructor Summary | |
|---|---|
Query(Selectable[] selects,
Type type,
Condition condition)
|
|
Query(Selectable<? extends R> select)
|
|
Query(Selectable<? extends R> select,
Condition condition)
|
|
Query(Selectable<R> select,
Type type,
Condition condition)
|
|
| Method Summary | ||
|---|---|---|
void |
addOrderBy(Function orderBy)
|
|
void |
addOrderBy(Function orderBy,
boolean ascending)
|
|
void |
addOrderByDescending(Function orderBy)
|
|
int |
countWithoutLimit()
Deprecated. Use total() instead |
|
static
|
emptyResult()
|
|
Condition |
getCondition()
|
|
List<Join> |
getJoins()
|
|
List<Boolean> |
getOrderByAscending()
|
|
List<Function> |
getOrderByFunctions()
|
|
Type |
getType()
|
|
boolean |
isDistinct()
|
|
Join |
join(Type type)
Does an inner join with the given type without any join condition. |
|
Join |
join(Type type,
Condition condition)
Does an inner join with the given type on the given join condition. |
|
Join |
joinOuterLeft(Type type,
Condition condition)
|
|
Join |
joinOuterRight(Type type,
Condition condition)
|
|
void |
narrow(Condition narrowingCondition)
If there is already a condition set for this query, this is equivalent to setCondition(getCondition(). |
|
void |
resetOrderBy()
|
|
List<R> |
search()
Searches for items matching this query. |
|
Query.Result<R> |
searchAndCountWithoutLimit()
Deprecated. Use searchAndTotal() instead |
|
Query.Result<R> |
searchAndTotal()
Searches for items matching this query. |
|
R |
searchSingleton()
Searches equivalently to search(),
but assumes that the search result has at most one element. |
|
R |
searchSingletonStrict()
Searches equivalently to search(),
but assumes that the search result has exactly one element. |
|
R |
searchUnique()
Deprecated. renamed to searchSingleton(). |
|
void |
setCondition(Condition condition)
|
|
void |
setDistinct(boolean distinct)
|
|
void |
setLimit(int offset)
|
|
void |
setLimit(int offset,
int limit)
|
|
void |
setOrderBy(Function[] orderBy,
boolean[] ascending)
|
|
void |
setOrderBy(Function orderBy,
boolean ascending)
|
|
void |
setOrderByAndThis(Function orderBy,
boolean ascending)
|
|
void |
setOrderByThis(boolean ascending)
|
|
void |
setSelects(Selectable... selects)
|
|
String |
toString()
|
|
int |
total()
Counts the items matching this query. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Query(Selectable<? extends R> select)
public Query(Selectable<? extends R> select,
Condition condition)
public Query(Selectable<R> select,
Type type,
Condition condition)
public Query(Selectable[] selects,
Type type,
Condition condition)
| Method Detail |
|---|
public void setSelects(Selectable... selects)
public boolean isDistinct()
public void setDistinct(boolean distinct)
public Type getType()
public void setCondition(Condition condition)
public Condition getCondition()
public void narrow(Condition narrowingCondition)
setCondition(getCondition().and(narrowingCondition)).
public Join join(Type type)
public Join join(Type type,
Condition condition)
public Join joinOuterLeft(Type type,
Condition condition)
public Join joinOuterRight(Type type,
Condition condition)
public List<Join> getJoins()
public List<Function> getOrderByFunctions()
public List<Boolean> getOrderByAscending()
public void setOrderByThis(boolean ascending)
public void setOrderBy(Function orderBy,
boolean ascending)
public void setOrderByAndThis(Function orderBy,
boolean ascending)
public void setOrderBy(Function[] orderBy,
boolean[] ascending)
IllegalArgumentException - if orderBy.length!=ascending.lengthpublic void addOrderBy(Function orderBy)
public void addOrderByDescending(Function orderBy)
public void addOrderBy(Function orderBy,
boolean ascending)
public void resetOrderBy()
public void setLimit(int offset,
int limit)
limit - the maximum number of items to be found.
IllegalArgumentException - if offset is a negative value
IllegalArgumentException - if limit is a negative valuesetLimit(int)public void setLimit(int offset)
IllegalArgumentException - if offset is a negative valuesetLimit(int, int)public List<R> search()
Returns an unmodifiable collection. Any attempts to modify the returned collection, whether direct or via its iterator, result in an UnsupportedOperationException.
public int total()
Returns the
size of what
search() would have returned for this query with
setLimit(int) reset set to (0).
public Query.Result<R> searchAndTotal()
Returns a Query.Result containing the
data and the
total.
The data is equal to
what search() would have returned for this query.
The total is equal to what
total() would have returned for this query.
This method does it's best to avoid issuing two queries for searching and totaling.
public static <R> Query.Result<R> emptyResult()
public R searchSingleton()
search(),
but assumes that the search result has at most one element.
Returns null, if the search result is empty,
returns the only element of the search result,
if the result size is exactly one.
IllegalArgumentException - if the search result size is greater than one.searchSingletonStrict(),
Type.searchSingleton(Condition)public R searchSingletonStrict()
search(),
but assumes that the search result has exactly one element.
Returns the only element of the search result,
if the result size is exactly one.
IllegalArgumentException - if the search result size is not exactly one.searchSingleton(),
Type.searchSingletonStrict(Condition)public String toString()
toString in class Object@Deprecated public Query.Result<R> searchAndCountWithoutLimit()
searchAndTotal() instead
@Deprecated public int countWithoutLimit()
total() instead
@Deprecated public R searchUnique()
searchSingleton().
|
Cope with Object Persistence |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||