Skip to content

Instantly share code, notes, and snippets.

@oehme
Created June 13, 2012 15:11
Show Gist options
  • Save oehme/2924669 to your computer and use it in GitHub Desktop.
Save oehme/2924669 to your computer and use it in GitHub Desktop.
Localized Boolean
public class LocalizedBooleanModel implements TemplateScalarModel, TemplateBooleanModel {
private final boolean value;
private final String yes;
private final String no;
public LocalizedBooleanModel(boolean value, String yes, String no) {
this.value = value;
this.yes = yes;
this.no = no;
}
@Override
public boolean getAsBoolean() throws TemplateModelException {
return value;
}
@Override
public String getAsString() throws TemplateModelException {
return value ? yes : no;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment