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 Link icon

    • PatternFormatter Link icon

      public PatternFormatter()
  • Method Details Link icon

    • insertPatternPart Link icon

      @Deprecated public static String insertPatternPart(String pattern, String key, String value)
      Deprecated.
    • processPattern Link icon

      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 Link icon

      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.