Interface Rewriteable<T>

    • Method Detail

      • rewrite

        T rewrite​(QueryRewriteContext ctx)
           throws java.io.IOException
        Rewrites this instance based on the provided context. The returned objects will be the same instance as this if no changes during the rewrite were applied.
        Throws:
        java.io.IOException
      • rewrite

        static <T extends Rewriteable<T>> T rewrite​(T original,
                                                    QueryRewriteContext context)
                                             throws java.io.IOException
        Rewrites the given Rewriteable into its primitive form. Rewriteables that for instance fetch resources from remote hosts or can simplify / optimize itself should do their heavy lifting during rewrite(QueryRewriteContext). This method rewrites the rewriteable until it doesn't change anymore.
        Parameters:
        original - the original rewriteable to rewrite
        context - the rewrite context to use
        Throws:
        java.io.IOException - if an IOException occurs
      • rewrite

        static <T extends Rewriteable<T>> T rewrite​(T original,
                                                    QueryRewriteContext context,
                                                    boolean assertNoAsyncTasks)
                                             throws java.io.IOException
        Rewrites the given Rewriteable into its primitive form. Rewriteables that for instance fetch resources from remote hosts or can simplify / optimize itself should do their heavy lifting during rewriteAndFetch(Rewriteable, QueryRewriteContext, ActionListener) (QueryRewriteContext)}. This method rewrites the rewriteable until it doesn't change anymore.
        Parameters:
        original - the original rewriteable to rewrite
        context - the rewrite context to use
        assertNoAsyncTasks - if true the rewrite will fail if there are any pending async tasks on the context after the rewrite. See QueryRewriteContext.executeAsyncActions(ActionListener) for detals
        Throws:
        java.io.IOException - if an IOException occurs
      • rewriteAndFetch

        static <T extends Rewriteable<T>> void rewriteAndFetch​(T original,
                                                               QueryRewriteContext context,
                                                               ActionListener<T> rewriteResponse)
        Rewrites the given rewriteable and fetches pending async tasks for each round before rewriting again.
      • rewriteAndFetch

        static <T extends Rewriteable<T>> void rewriteAndFetch​(T original,
                                                               QueryRewriteContext context,
                                                               ActionListener<T> rewriteResponse,
                                                               int iteration)
        Rewrites the given rewriteable and fetches pending async tasks for each round before rewriting again.
      • rewrite

        static <T extends Rewriteable<T>> java.util.List<T> rewrite​(java.util.List<T> rewritables,
                                                                    QueryRewriteContext context)
                                                             throws java.io.IOException
        Rewrites each element of the list until it doesn't change and returns a new list iff there is at least one element of the list that changed during it's rewrite. Otherwise the given list instance is returned unchanged.
        Throws:
        java.io.IOException