Class TextTemplate

    • Method Detail

      • isTrim

        public boolean isTrim()
      • setTrim

        public void setTrim​(boolean trim)
        Set to true in order to trim invisible characters (spaces) from values.
      • processString

        protected String processString​(CryptoProperties props,
                                       String text)
        That method is not recursive. It processes the given text only once.
        Parameters:
        props - CryptoProperties containing the variable values
        text - Text to process
        Returns:
        the processed text
        Since:
        7.4
      • processString

        protected String processString​(CryptoProperties props,
                                       String text,
                                       Function<String,​String> transform)
        That method is not recursive. It processes the given text only once.
        Parameters:
        props - CryptoProperties containing the variable values
        text - Text to process
        transform - Function to transform (quote, escape, etc.) processed vars
        Returns:
        the processed text
        Since:
        2021.22
      • processText

        public String processText​(String content)
        Since:
        7.4
      • processText

        public String processText​(String text,
                                  Function<String,​String> transform)
        It processes the given text.
        Parameters:
        text - Text to process
        transform - Function to transform (quote, escape, etc.) processed variables within text
        Returns:
        the processed text
        Since:
        2021.22
      • initFreeMarker

        public void initFreeMarker()
        Initialize FreeMarker data model from Java properties.

        Variables in the form "foo.bar" (String with dots) are transformed to "foo[bar]" (arrays).
        So there will be conflicts if a variable name is equal to the prefix of another variable. For instance, " foo.bar" and "foo.bar.qux" will conflict.
        When a conflict occurs, the conflicting variable is ignored and a warning is logged. The ignored variable will usually be the shortest one (without any contract on this behavior).

      • processFreemarker

        public void processFreemarker​(File in,
                                      File out)
                               throws IOException,
                                      freemarker.template.TemplateException
        Throws:
        IOException
        freemarker.template.TemplateException
      • setTextParsingExtensions

        public void setTextParsingExtensions​(String extensionsList)
        Parameters:
        extensionsList - comma-separated list of files extensions to parse
      • setFreemarkerParsingExtensions

        public void setFreemarkerParsingExtensions​(String extensionsList)
      • setKeepEncryptedAsVar

        public void setKeepEncryptedAsVar​(boolean keepEncryptedAsVar)
        Whether to replace or not the variables which value is encrypted.
        Parameters:
        keepEncryptedAsVar - if true, the variables which value is encrypted won't be expanded
        Since:
        7.4
      • keepEncryptedAsVar

        public TextTemplate keepEncryptedAsVar​(boolean keepEncryptedAsVar)
        Whether to replace or not the variables which value is encrypted.
        Parameters:
        keepEncryptedAsVar - if true, the variables which value is encrypted won't be expanded
        Returns:
        this object to ease chaining
        Since:
        2021.14