public static class Formats.AnnotationDateFormatter extends Formatters.AnnotationFormatter<Formats.DateTime,java.util.Date>
@DateTime
annotation.Constructor and Description |
---|
AnnotationDateFormatter(MessagesApi messagesApi)
Creates an annotation date formatter.
|
Modifier and Type | Method and Description |
---|---|
java.util.Date |
parse(Formats.DateTime annotation,
java.lang.String text,
java.util.Locale locale)
Binds the field - constructs a concrete value from submitted data.
|
java.lang.String |
print(Formats.DateTime annotation,
java.util.Date value,
java.util.Locale locale)
Unbinds this field - converts a concrete value to plain string
|
public AnnotationDateFormatter(MessagesApi messagesApi)
messagesApi
- messages to look up the patternpublic java.util.Date parse(Formats.DateTime annotation, java.lang.String text, java.util.Locale locale) throws java.text.ParseException
parse
in class Formatters.AnnotationFormatter<Formats.DateTime,java.util.Date>
annotation
- the annotation that triggered this formattertext
- the field textlocale
- the current Locale
java.text.ParseException
- when the text could not be parsedpublic java.lang.String print(Formats.DateTime annotation, java.util.Date value, java.util.Locale locale)
print
in class Formatters.AnnotationFormatter<Formats.DateTime,java.util.Date>
annotation
- the annotation that triggered this formattervalue
- the value to unbindlocale
- the current Locale