Class VariablesUtility


  • public class VariablesUtility
    extends Object
    Utility for replacement of expressions with variables in texts. An expression consists of three parts: {prefix:name:defaultValue}. The prefix tells the variable utility which processor to use, the name and default value are submitted to the processor in question.
    Author:
    lrosenberg
    • Constructor Detail

      • VariablesUtility

        public VariablesUtility()
    • Method Detail

      • addProcessor

        public static void addProcessor​(String prefix,
                                        VariablesProcessor processor)
        Adds a processor to this variable utility.
        Parameters:
        prefix - prefix for processor mapping.
        processor - processor.
      • replaceLocalizationBundleVariables

        public static String replaceLocalizationBundleVariables​(String source)
      • replaceVariables

        public static String replaceVariables​(jakarta.servlet.http.HttpServletRequest req,
                                              String src)
        Replaces variable expressions in the given string src with help of default processors.
        Parameters:
        req - TODO dummy comment for javadoc.
        src - TODO dummy comment for javadoc.
      • replaceVariables

        public static String replaceVariables​(jakarta.servlet.http.HttpServletRequest req,
                                              String src,
                                              Map<String,​VariablesProcessor> processors)
        Replaces variable expressions in the given string src with the help of submitted processors. Useful for variable customization.
        Parameters:
        req - request
        src - source string
        processors - processors
        Returns:
        returns a string with variables replaced.
      • replaceVariables

        public static String replaceVariables​(jakarta.servlet.http.HttpServletRequest req,
                                              List<net.anotheria.util.content.element.ContentElement> index,
                                              Map<String,​VariablesProcessor> processors)
      • indexSource

        public static List<net.anotheria.util.content.element.ContentElement> indexSource​(String src)