T
- domain object type.public class SearchBuilder<T extends Searchable>
extends java.lang.Object
searchable repository
.
Search can be performed using more fluent API,
by providing specification limit, offset and custom orderConstructor and Description |
---|
SearchBuilder(SearchableRepository<T> repository)
Constructor for SearchBuilder which requires a repository to perform
a search.
|
Modifier and Type | Method and Description |
---|---|
SearchBuilder<T> |
ascending(java.lang.String property)
Order result ascending using a provided property
|
SearchBuilder<T> |
descending(java.lang.String property)
Order result descending using a provided property
|
SearchBuilder<T> |
filter(Specification<T> specification)
Provide
search predicate for filtering results. |
SearchBuilder<T> |
limit(int limit)
Define a maximum number of results
|
SearchBuilder<T> |
offset(int offset)
Define a number of results to be skipped.
|
java.util.concurrent.Future<java.util.List<T>> |
search()
Returns a list of domain objects which satisfy
specification if it was set, otherwise all of them. |
SearchBuilder<T> |
skip(int offset)
Define a number of results to be skipped.
|
SearchBuilder<T> |
take(int limit)
Define a maximum number of results.
|
SearchBuilder<T> |
with(Specification<T> specification)
Provide
search predicate for filtering results. |
public SearchBuilder(SearchableRepository<T> repository)
repository
- domain object repositorypublic SearchBuilder<T> with(Specification<T> specification)
search predicate
for filtering results.specification
- search predicatepublic SearchBuilder<T> filter(Specification<T> specification)
search predicate
for filtering results.specification
- search predicatepublic SearchBuilder<T> limit(int limit)
limit
- maximum number of resultspublic SearchBuilder<T> take(int limit)
limit
- maximum number of resultspublic SearchBuilder<T> offset(int offset)
offset
- number of results to be skippedpublic SearchBuilder<T> skip(int offset)
offset
- number of results to be skippedpublic SearchBuilder<T> ascending(java.lang.String property)
property
- name of domain objects propertypublic SearchBuilder<T> descending(java.lang.String property)
property
- name of domain objects propertypublic java.util.concurrent.Future<java.util.List<T>> search()
specification
if it was set, otherwise all of them.
Parameters can be previously set to limit
results,
skip offset
of initial results and order
by some of this domain objects properties.