Created
June 13, 2012 15:11
-
-
Save oehme/2924669 to your computer and use it in GitHub Desktop.
Localized Boolean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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