Class PatternFormatter

java.lang.Object
org.bgerp.util.text.PatternFormatter

public class PatternFormatter extends Object
Processor for substitution patterns like
${key} text (text1 ${key1})}
. Braces bound not mandatory area, being added only when for the key inside has defined a value.
  • Constructor Details

    • PatternFormatter

      public PatternFormatter()
  • Method Details

    • processPattern

      public static String processPattern(String pattern, Function<String,String> processor)
      Executes substitutions in a pattern
      Parameters:
      pattern - the pattern
      processor - values provider for found variables, provided null values treated as empty strings
      Returns:
      the pattern with applied substitutions
    • processPattern

      public static String processPattern(String pattern, Map<String,String> values)
      Executes substitutions in a pattern
      Parameters:
      pattern - the pattern
      values - variable values map, provided null values treated as empty strings
      Returns:
      the pattern with applied substitutions