Class StringSearchInterpolator

    • Field Detail

      • existingAnswers

        private java.util.Map<java.lang.String,​java.lang.Object> existingAnswers
      • valueSources

        private java.util.List<ValueSource> valueSources
      • cacheAnswers

        private boolean cacheAnswers
      • DEFAULT_START_EXPR

        public static final java.lang.String DEFAULT_START_EXPR
        See Also:
        Constant Field Values
      • DEFAULT_END_EXPR

        public static final java.lang.String DEFAULT_END_EXPR
        See Also:
        Constant Field Values
      • startExpr

        private java.lang.String startExpr
      • endExpr

        private java.lang.String endExpr
      • escapeString

        private java.lang.String escapeString
    • Constructor Detail

      • StringSearchInterpolator

        public StringSearchInterpolator()
      • StringSearchInterpolator

        public StringSearchInterpolator​(java.lang.String startExpr,
                                        java.lang.String endExpr)
    • Method Detail

      • interpolate

        public java.lang.String interpolate​(java.lang.String input,
                                            java.lang.String thisPrefixPattern,
                                            RecursionInterceptor recursionInterceptor)
                                     throws InterpolationException
        Description copied from interface: Interpolator
        Attempt to resolve all expressions in the given input string, using the given pattern to first trim an optional prefix from each expression. The supplied recursion interceptor will provide protection from expression cycles, ensuring that the input can be resolved or an exception is thrown. return an empty String if input is null
        Specified by:
        interpolate in interface Interpolator
        Parameters:
        input - The input string to interpolate
        thisPrefixPattern - An optional pattern that should be trimmed from the start of any expressions found in the input.
        recursionInterceptor - Used to protect the interpolation process from expression cycles, and throw an exception if one is detected.
        Returns:
        interpolated string.
        Throws:
        InterpolationException - in case of an error.
      • interpolate

        public java.lang.String interpolate​(java.lang.String input,
                                            RecursionInterceptor recursionInterceptor)
                                     throws InterpolationException
        Entry point for recursive resolution of an expression and all of its nested expressions. TODO: Ensure unresolvable expressions don't trigger infinite recursion.
        Specified by:
        interpolate in interface BasicInterpolator
        Parameters:
        input - The input string to interpolate
        recursionInterceptor - Used to protect the interpolation process from expression cycles, and throw an exception if one is detected.
        Returns:
        the interpolated string.
        Throws:
        InterpolationException - in case of an error.
      • getFeedback

        public java.util.List getFeedback()
        Return any feedback messages and errors that were generated - but suppressed - during the interpolation process. Since unresolvable expressions will be left in the source string as-is, this feedback is optional, and will only be useful for debugging interpolation problems.
        Specified by:
        getFeedback in interface Interpolator
        Returns:
        a List that may be interspersed with String and Throwable instances.
      • clearFeedback

        public void clearFeedback()
        Clear the feedback messages from previous interpolate(..) calls.
        Specified by:
        clearFeedback in interface Interpolator
      • isCacheAnswers

        public boolean isCacheAnswers()
        Specified by:
        isCacheAnswers in interface Interpolator
        Returns:
        state of the cacheAnswers
      • setCacheAnswers

        public void setCacheAnswers​(boolean cacheAnswers)
        Specified by:
        setCacheAnswers in interface Interpolator
        Parameters:
        cacheAnswers - true/false.
      • getEscapeString

        public java.lang.String getEscapeString()
      • setEscapeString

        public void setEscapeString​(java.lang.String escapeString)