|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Finder<Type>
A factory for providing results of a search. Finder
implementations must be immutable.
Nested Class Summary | |
---|---|
static interface |
Finder.FilterSortCriterion<Type>
An interface that should be implemented by specific Finder.SortCriterion objects which are capable to implement
by themselves the sorting of objects, by post-processing an existing collection of objects. |
static interface |
Finder.SortCriterion
A tag interface to mark objects which are meaningful sort criteria that can be passed to sort(it.tidalwave.util.Finder.SortCriterion) . |
static class |
Finder.SortDirection
An enumeration to define the direction of a sort (ascending or descending). |
Method Summary | ||
---|---|---|
int |
count()
Performs the search and returns the count of found items. |
|
Type |
firstResult()
Performs the search and returns only the first found item. |
|
Finder<Type> |
from(int firstResult)
Tells the Finder that only a subset of found items will be returned, starting from the given position. |
|
Finder<Type> |
max(int maxResults)
Tells the Finder that only a maximum number of found items will be returned. |
|
|
ofType(Class<AnotherType> type)
|
|
Type |
result()
Performs the search assuming that it will return a single item and returns it. |
|
List<? extends Type> |
results()
Performs the search and returns the found items. |
|
Finder<Type> |
sort(Finder.SortCriterion criterion)
Tells the Finder that results will be sorted according to the given criterion, in ascending direction. |
|
Finder<Type> |
sort(Finder.SortCriterion criterion,
Finder.SortDirection direction)
Tells the Finder that results will be sorted according to the given criterion and direction. |
Method Detail |
---|
@Nonnull Finder<Type> from(@Nonnegative int firstResult)
Finder
that only a subset of found items will be returned, starting from the given position.
Finder
@Nonnull Finder<Type> max(@Nonnegative int maxResults)
Finder
that only a maximum number of found items will be returned.
Finder
@Nonnull <AnotherType> Finder<AnotherType> ofType(@Nonnull Class<AnotherType> type)
Finder
@Nonnull Finder<Type> sort(@Nonnull Finder.SortCriterion criterion)
Finder
that results will be sorted according to the given criterion, in ascending direction.
criterion
- the sort criterion
Finder
@Nonnull Finder<Type> sort(@Nonnull Finder.SortCriterion criterion, @Nonnull Finder.SortDirection direction)
Finder
that results will be sorted according to the given criterion and direction.
criterion
- the sort criteriondirection
- the sort direction
Finder
@Nonnull Type result() throws NotFoundException
NotFoundException
- if the search didn't find anything
RuntimeException
- if the search returned more than one single item@Nonnull Type firstResult() throws NotFoundException
NotFoundException
- if the search didn't find anything@Nonnull List<? extends Type> results()
@Nonnegative int count()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |