Package org.bgerp.util.text

# 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 Summary

  Constructors
  Constructor
  Description
  `PatternFormatter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `processPattern(String pattern, Function<String,String> processor)`
  Executes substitutions in a pattern
  `static String`
  `processPattern(String pattern, Map<String,String> values)`
  Executes substitutions in a pattern

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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