Commit 942da8bd authored by mackeprm's avatar mackeprm Committed by Andy Wilkinson

Support configuration of defaultValue and emptyStringIsFalse

This commit adds support for configuring defaultValue and
emptyStringIsFalse to MustacheCompilerFactoryBean.

Closes gh-4057
parent 1e801723
......@@ -48,6 +48,10 @@ public class MustacheCompilerFactoryBean implements FactoryBean<Mustache.Compile
private Compiler compiler;
private String defaultValue;
private Boolean emptyStringIsFalse;
public void setDelims(String delims) {
this.delims = delims;
}
......@@ -68,6 +72,14 @@ public class MustacheCompilerFactoryBean implements FactoryBean<Mustache.Compile
this.collector = collector;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public void setEmptyStringIsFalse(Boolean emptyStringIsFalse) {
this.emptyStringIsFalse = emptyStringIsFalse;
}
@Override
public Mustache.Compiler getObject() throws Exception {
this.compiler = Mustache.compiler();
......@@ -86,6 +98,12 @@ public class MustacheCompilerFactoryBean implements FactoryBean<Mustache.Compile
if (this.collector != null) {
this.compiler = this.compiler.withCollector(this.collector);
}
if (this.defaultValue != null) {
this.compiler = this.compiler.defaultValue(this.defaultValue);
}
if (this.emptyStringIsFalse != null) {
this.compiler = this.compiler.emptyStringIsFalse(this.emptyStringIsFalse);
}
return this.compiler;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment