Interface ExtendedFinderSupport<TYPE,​EXTENDED_FINDER extends Finder<TYPE>>

  • All Superinterfaces:
    java.lang.Cloneable, Finder<TYPE>, java.io.Serializable

    public interface ExtendedFinderSupport<TYPE,​EXTENDED_FINDER extends Finder<TYPE>>
    extends Finder<TYPE>
    A utility interface for creating extended Finders, it provides automatic covariant return types. Make your extended Finder interface to extend from this. For instance, a custom Date finder can be declared as:
     public interface DateFinder extends ExtendedFinderSupport<SomeClass, DateFinder>
       {
         public DateFinder before (Date date);
    
         public DateFinder after (Date date);
       }
     
    Author:
    Fabrizio Giudici
    Status: draft API
    • Method Detail

      • from

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

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

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

        @Nonnull
        EXTENDED_FINDER sort​(@Nonnull
                             Finder.SortCriterion criterion,
                             @Nonnull
                             Finder.SortDirection direction)
        Tells the Finder that results will be sorted according to the given criterion and direction.
        Specified by:
        sort in interface Finder<TYPE>
        Parameters:
        criterion - the sort criterion
        direction - the sort direction
        Returns:
        the Finder
      • withContext

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