Created
June 13, 2012 14:50
-
-
Save oehme/2924548 to your computer and use it in GitHub Desktop.
Local Date Model
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 LocalDateModel extends BeanModel implements TemplateScalarModel { | |
private final LocalDate object; | |
private final Locale locale; | |
public LocalDateModel(LocalDate object, Locale locale, BeansWrapper wrapper) { | |
super(object, wrapper); | |
this.object = object; | |
this.locale = locale; | |
} | |
@Override | |
public String getAsString() throws TemplateModelException { | |
DateTimeFormatter formatter = DateTimeFormat.forStyle("M-").withLocale(locale); | |
return formatter.print(object); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment