Package ru.bgcrm.util
Class PatternFormatter
java.lang.Object
ru.bgcrm.util.PatternFormatter
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
insertPatternPart
(String pattern, String key, String value) Deprecated.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.
-
Constructor Details
-
PatternFormatter
public PatternFormatter()
-
-
Method Details
-
insertPatternPart
Deprecated.UseprocessPattern(String, Map)
instead. -
processPattern
Executes substitutions in a pattern.- Parameters:
pattern
- the pattern.processor
- values provider for found variables, providednull
values treated as empty strings.- Returns:
- pattern with applied substitutions.
-
processPattern
Executes substitutions in a pattern.- Parameters:
pattern
- the pattern.values
- variable values map, providednull
values treated as empty strings.- Returns:
- pattern with applied substitutions.
-