|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ISearch
The base search DTO (data transfer object). A Search object is passed into a DAO or Search Processor to define the parameters for a search. There are six types of parameters that can be set.
disjunction == true. See also the Filter class.
Sort class.
resultMode. See also the Field
class.COUNT, COUNT DISTINCT, SUM, AVG, MAX, MIN. Note that fields with
column operators can not be mixed with fields that do not use column
operators.distinct to true in order to filter out
duplicate results.maxResults. (This can also be thought of as results per page.)
The first result can be specified using either firstResult or
page.
ISearch is intended to be an immutable interface and only
provides getters for each of the properties. The IMutableSearch
interface extends ISearch by adding setters for all the
properties.
Filter,
Field,
Sort,
IMutableSearch| Field Summary | |
|---|---|
static int |
RESULT_ARRAY
Value for result mode. |
static int |
RESULT_AUTO
Value for result mode. |
static int |
RESULT_LIST
Value for result mode. |
static int |
RESULT_MAP
Value for result mode. |
static int |
RESULT_SINGLE
Value for result mode. |
| Method Summary | |
|---|---|
java.util.List<java.lang.String> |
getFetches()
|
java.util.List<Field> |
getFields()
|
java.util.List<Filter> |
getFilters()
|
int |
getFirstResult()
Zero based index of first result record to return. |
int |
getMaxResults()
The maximum number of records to return. |
int |
getPage()
Zero based index of the page of records to return. |
int |
getResultMode()
Result mode tells the search what form to use for the results. |
java.lang.Class<?> |
getSearchClass()
|
java.util.List<Sort> |
getSorts()
|
boolean |
isDisjunction()
|
boolean |
isDistinct()
|
| Field Detail |
|---|
static final int RESULT_AUTO
RESULT_AUTO the result mode is automatically determined
according to the following rules:
RESULT_MAP.
RESULT_SINGLE.
RESULT_ARRAY.
getResultMode(),
Constant Field Valuesstatic final int RESULT_ARRAY
RESULT_ARRAY returns each result as
an Object array (Object[]) with the entries corresponding to
the fields added to the search. Here's an example:
Search s = new Search(Person.class);
s.setResultMode(Search.RESULT_ARRAY);
s.addField("firstName");
s.addField("lastName");
for (Object[] array : dao.search(s)) {
System.out.println(array[0] + " " + array[1]);
}
getResultMode(),
Constant Field Valuesstatic final int RESULT_LIST
RESULT_LIST returns each result as a
list of Objects (List<Object> ). Here's an example:
Search s = new Search(Person.class);
s.setResultMode(Search.RESULT_LIST);
s.addField("firstName");
s.addField("lastName");
for (List<Object> list : dao.search(s)) {
System.out.println(list.get(0) + " " + list.get(1));
}
getResultMode(),
Constant Field Valuesstatic final int RESULT_MAP
RESULT_MAP returns each row as a map
with properties' names or keys for keys to the corresponding values.
Here's an example:
Search s = new Search(Person.class);
s.setResultMode(Search.RESULT_MAP;
s.addField("firstName");
s.addField("lastName", "ln");
for (Map<String, Object> map : dao.search(s)) {
System.out.println(map.get("firstName") + " " + map.get("ln"));
}
getResultMode(),
Constant Field Valuesstatic final int RESULT_SINGLE
RESULT_SINGLE - Exactly one field or
no fields must be specified to use this result mode. The result list
contains just the value of that property for each element. Here's an
example:
Search s = new Search(Person.class);
s.setResultMode(Search.RESULT_SINGLE);
s.addField("firstName");
for (Object name : dao.search(s)) {
System.out.println(name);
}
getResultMode(),
Constant Field Values| Method Detail |
|---|
int getFirstResult()
<= 0 for unspecified value.
int getMaxResults()
page.
<= 0 for unspecified value.
int getPage()
maxResults. If both page and
maxResults are specified (i.e. > 0), the first result
returned is calculated by page * maxResults.
firstResult has precedence over page. So if
firstResult is specified (i.e. > 0), page is
ignored.
<= 0 for unspecified value.
java.lang.Class<?> getSearchClass()
java.util.List<Filter> getFilters()
boolean isDisjunction()
java.util.List<Sort> getSorts()
java.util.List<Field> getFields()
boolean isDistinct()
java.util.List<java.lang.String> getFetches()
int getResultMode()
RESULT_AUTO, RESULT_ARRAY,
RESULT_LIST
, RESULT_MAP and RESULT_SINGLE
.
RESULT_AUTO,
RESULT_ARRAY,
RESULT_LIST,
RESULT_MAP,
RESULT_SINGLE
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||