Class Template


  • public class Template
    extends Object
    Simple template engine functions that replaces %{...} in an array of strings or a single string. Error handling can be deduced from the unit test. Uses %{..} to avoid replacing ${} strings which are not our concern
    • Constructor Detail

      • Template

        protected Template()
        Prohibit external construction for now.
    • Method Detail

      • untemplate

        public static String untemplate​(String[] strArray,
                                        Map<String,​String> env,
                                        boolean bFailOnMissing,
                                        String separator)
        Takes an array of strings and returns a concatenated string with all %{...} occurrences replaced according to the env map.
        Parameters:
        strArray - array of strings to be processed with env strings
        env - map of replacement strings
        bFailOnMissing - throw an exception on missing replacement string or not
        separator - separator to insert between lines or null
        Returns:
        concatenated and processed string
      • untemplate

        public static String untemplate​(String str,
                                        Map<String,​String> env,
                                        boolean bFailOnMissing)
        Takes a string and replaces all %{...} occurrences with env map strings.
        Parameters:
        str - string to be processed
        env - map of replacement strings
        bFailOnMissing - throw an exception on missing replacement string or not
        Returns:
        processed string