Package ru.bgcrm.util

Class PatternFormatter

java.lang.Object
ru.bgcrm.util.PatternFormatter

public class PatternFormatter extends Object
Processor for substitution patterns like
(${key})(текст ${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

    • insertPatternPart

      @Deprecated public static String insertPatternPart(String pattern, String key, String value)
      Deprecated.
    • 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:
      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:
      pattern with applied substitutions.