Interface SearchHandler.Builder<T>

  • Type Parameters:
    T - search entity type.
    Enclosing interface:
    SearchHandler<T>

    public static interface SearchHandler.Builder<T>
    Builds SearchHandlers.
    • Method Detail

      • argument

        SearchHandler.Builder<T> argument​(java.lang.String name,
                                          SearchArgumentHandler handler)
        Binds the specified argument handler to the key described by name.
        Parameters:
        name - name of the key to bind to (i.e.: argument:value)
        handler - handler to associate with the specified argument name.
        Returns:
        Builder instance.
      • command

        SearchHandler.Builder<T> command​(java.lang.String name,
                                         SearchArgumentHandler handler)
        Binds the specified argument handler to the command key described by name.
        Parameters:
        name - name of the key to bind to (i.e.: command)
        handler - handler to associate with the specified argument name.
        Returns:
        Builder instance.
      • string

        SearchHandler.Builder<T> string​(SearchArgumentHandler handler)
        Binds the specified argument handler to any string query used (i.e.: "test string" text in query). If no string handler is specified, exceptions are thrown during search.
        Parameters:
        handler - handler to associate with any quoted string query.
        Returns:
        Builder instance.
      • always

        SearchHandler.Builder<T> always​(java.util.function.Consumer<SearchHandler.Clause<T>> executionConsumer)
        Executes the provided execution as a filter on every search execution.
        Parameters:
        executionConsumer - Search execution consumer.
        Returns:
        Builder instance.
      • sort

        SearchHandler.Builder<T> sort​(java.lang.String key,
                                      SearchOrderHandler handler)
        Binds the specified key to an order handler.
        Parameters:
        key - key to bind to.
        handler - handler to associate with ordering the result list.
        Returns:
        Builder instance.
      • sort

        default SearchHandler.Builder<T> sort​(java.lang.String key,
                                              java.lang.String field)
        Binds the specified key to an order handler.
        Parameters:
        key - key to bind to.
        field - field name to associate with ordering the result list.
        Returns:
        Builder instance.
      • sort

        default SearchHandler.Builder<T> sort​(java.lang.String key,
                                              java.util.function.Function<javax.persistence.criteria.Root,​javax.persistence.criteria.Path> function)
        Binds the specified key to an order handler.
        Parameters:
        key - key to bind to.
        function - function to associate with ordering the result list.
        Returns:
        Builder instance.
      • defaultSort

        SearchHandler.Builder<T> defaultSort​(java.lang.String key,
                                             SortOrder order)
        Sets the specific order key as the default order handler.
        Parameters:
        key - key to designate as the default order.
        order - default order.
        Returns:
        Builder instance.
      • defaultSort

        default SearchHandler.Builder<T> defaultSort​(java.lang.String key)
        Sets the specific order key as the default ascending order handler.
        Parameters:
        key - key to designate as the default order.
        Returns:
        Builder instance.
      • build

        SearchHandler<T> build()
                        throws java.lang.IllegalArgumentException
        Builds the search handler, capable of executing searches with the pre-formatted parameters.
        Returns:
        SearchHandler instance.
        Throws:
        java.lang.IllegalArgumentException - if there was an argument exception while discerning parsing steps.