public class TemplateUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TemplateUtils.MissingValue
Some information about a Mustache template parameter which wasn't found in the provided environment map.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
renderMustache(java.lang.String templateName,
java.lang.String templateContent,
java.util.Map<java.lang.String,java.lang.String> values,
java.util.List<TemplateUtils.MissingValue> missingValues)
Renders a given Mustache template using the provided value map, returning any template parameters which weren't
present in the map.
|
static java.lang.String |
renderMustacheThrowIfMissing(java.lang.String templateName,
java.lang.String templateContent,
java.util.Map<java.lang.String,java.lang.String> values)
Renders a given Mustache template using the provided value map, throwing an exception if any template parameters
weren't found in the map.
|
static void |
validateMissingValues(java.lang.String templateName,
java.util.Map<java.lang.String,java.lang.String> values,
java.util.Collection<TemplateUtils.MissingValue> missingValues)
Throws a descriptive exception if
missingValues is non-empty. |
public static java.lang.String renderMustache(java.lang.String templateName,
java.lang.String templateContent,
java.util.Map<java.lang.String,java.lang.String> values,
java.util.List<TemplateUtils.MissingValue> missingValues)
templateContent - String representation of templatevalues - Map of values to be inserted into the templatemissingValues - List where missing value entries will be added for any template params in
templateContent which are not found in valuespublic static java.lang.String renderMustacheThrowIfMissing(java.lang.String templateName,
java.lang.String templateContent,
java.util.Map<java.lang.String,java.lang.String> values)
throws MustacheException
templateContent - String representation of templatevalues - Map of values to be inserted into the templateMustacheException - if parameters in the templateContent weren't provided in the valuespublic static void validateMissingValues(java.lang.String templateName,
java.util.Map<java.lang.String,java.lang.String> values,
java.util.Collection<TemplateUtils.MissingValue> missingValues)
throws MustacheException
missingValues is non-empty. Exposed as a utility function to allow
custom filtering of missing values before the validation occurs.MustacheException