Support configuration of defaultValue and emptyStringIsFalse
This commit adds support for configuring defaultValue and emptyStringIsFalse to MustacheCompilerFactoryBean. Closes gh-4057
This commit is contained in:
		
							parent
							
								
									1e8017232b
								
							
						
					
					
						commit
						942da8bdd3
					
				| 
						 | 
				
			
			@ -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;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue