Interface Finder<TYPE>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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.
      <AnotherType>
      Finder<AnotherType>
      ofType​(Class<AnotherType> type)
      Tells the Finder that the specified type of results is expected.
      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.
      Finder<TYPE> withContext​(Object context)
      Tells the Finder that results should be created with the given context.
    • Method Detail

      • from

        @Nonnull
        Finder<TYPE> from​(@Nonnegative
                          int firstResult)
        Tells the Finder that only a subset of found items will be returned, starting from the given position.
        Parameters:
        firstResult - the index of the first result to return
        Returns:
        the Finder
      • max

        @Nonnull
        Finder<TYPE> max​(@Nonnegative
                         int maxResults)
        Tells the Finder that only a maximum number of found items will be returned.
        Parameters:
        maxResults - the max number of results to return
        Returns:
        the Finder
      • withContext

        @Nonnull
        Finder<TYPE> withContext​(@Nonnull
                                 Object context)
        Tells the Finder that results should be created with the given context. This method can be called multiple times; contexts are accumulated.
        Parameters:
        context - the context
        Returns:
        the Finder
      • ofType

        @Nonnull
        <AnotherType> Finder<AnotherType> ofType​(@Nonnull
                                                 Class<AnotherType> type)
        Tells the Finder that the specified type of results is expected.
        Parameters:
        type - the expected type of results
        Returns:
        the Finder
      • sort

        @Nonnull
        Finder<TYPE> sort​(@Nonnull
                          Finder.SortCriterion criterion)
        Tells the Finder that results will be sorted according to the given criterion, in ascending direction.
        Parameters:
        criterion - the sort criterion
        Returns:
        the Finder
      • results

        @Nonnull
        List<? extends TYPE> results()
        Performs the search and returns the found items.
        Returns:
        the searched items
      • count

        @Nonnegative
        int count()
        Performs the search and returns the count of found items.
        Returns:
        the count of found items