freemarker.core
static class: BuiltIn.stringBI.BooleanFormatter [javadoc |
source]
java.lang.Object
freemarker.core.BuiltIn$stringBI$BooleanFormatter
All Implemented Interfaces:
TemplateMethodModel, TemplateScalarModel
Method from freemarker.core.BuiltIn$stringBI$BooleanFormatter Summary: |
---|
exec, getAsString |
Method from freemarker.core.BuiltIn$stringBI$BooleanFormatter Detail: |
public Object exec(List arguments) throws TemplateModelException {
if (arguments.size() != 2) {
throw new TemplateModelException(
"boolean?string(...) requires exactly "
+ "2 arguments.");
}
return new SimpleScalar(
(String) arguments.get(bool.getAsBoolean() ? 0 : 1));
}
|
public String getAsString() throws TemplateModelException {
if (bool instanceof TemplateScalarModel) {
return ((TemplateScalarModel) bool).getAsString();
} else {
return env.getBooleanFormat(bool.getAsBoolean());
}
}
|