Package io.bdeploy.common.util
Class TemplateHelper
java.lang.Object
io.bdeploy.common.util.TemplateHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringprocess(String value, VariableResolver valueResolver) Resolves all variable references in the given string using the given resolver.static Stringprocess(String value, VariableResolver valueResolver, ShouldResolve shouldResolve) Resolves all variable references in the given String, using the given resolver.process(List<String> values, VariableResolver valueResolver) Resolves all variable references in the given list of strings using the given resolver.process(List<String> values, VariableResolver valueResolver, ShouldResolve shouldResolve) Asks the given resolver callback whether or not to resolve the variables contained in the given list of strings.static voidprocessFileTemplates(Path path, VariableResolver resolver) static StringupdateReferences(String value, UnaryOperator<String> processor) Processes each template reference in the given input by calling the given processor.
-
Method Details
-
process
Resolves all variable references in the given list of strings using the given resolver.- Parameters:
values- the raw values, potentially containing variable references.valueResolver- knows how to replace references with the actual content- Returns:
- the resolved strings
-
process
public static List<String> process(List<String> values, VariableResolver valueResolver, ShouldResolve shouldResolve) Asks the given resolver callback whether or not to resolve the variables contained in the given list of strings. The callback can be used to skip resolving of given variables.- Parameters:
values- the raw values, potentially containing variable references.valueResolver- knows how to replace references with the actual contentshouldResolve- callback to ask whether or not to resolve the given variable- Returns:
- the resolved strings
-
process
Resolves all variable references in the given string using the given resolver.- Parameters:
value- the raw value, potentially containing variable references.valueResolver- knows how to replace references with the actual content- Returns:
- the resolved string
-
process
public static String process(String value, VariableResolver valueResolver, ShouldResolve shouldResolve) Resolves all variable references in the given String, using the given resolver. The callback can be used to skip resolving of given variables.- Parameters:
value- the raw value, potentially containing variable references.valueResolver- knows how to replace references with the actual contentshouldResolve- callback to ask whether or not to resolve the given variable- Returns:
- the resolved string
-
updateReferences
Processes each template reference in the given input by calling the given processor.Whatever result is returned by the processor will be re-inserted *as template variable* (including the pattern start and end markers!) in the string.
-
processFileTemplates
- Parameters:
path- a folder containing files to recursively read/expand templates/write.resolver- theVariableResolverused to resolve all references.
-