Interface StaticContextCalculator

    • Method Detail

      • forSingleContext

        static StaticContextCalculator forSingleContext​(String key,
                                                        Supplier<String> valueFunction)
        Creates a new StaticContextCalculator that provides a single context.
        Parameters:
        key - the key of the context provided by the calculator
        valueFunction - the function used to compute the corresponding value for each query. A context will not be "accumulated" if the value returned is null.
        Returns:
        the resultant calculator
      • calculate

        void calculate​(@NonNull ContextConsumer consumer)
        Submits any contexts this calculator determines to be applicable.

        Care should be taken to ensure implementations of this method meet the general requirements for ContextCalculator, defined in the class doc.

        Parameters:
        consumer - the ContextConsumer to submit contexts to