Package play.data.format
Class Formats.AnnotationDateFormatter
- Object
-
- play.data.format.Formatters.AnnotationFormatter<Formats.DateTime,Date>
-
- play.data.format.Formats.AnnotationDateFormatter
-
- Enclosing class:
- Formats
public static class Formats.AnnotationDateFormatter extends Formatters.AnnotationFormatter<Formats.DateTime,Date>
Annotation formatter, triggered by the@DateTime
annotation.
-
-
Constructor Summary
Constructors Constructor Description AnnotationDateFormatter(MessagesApi messagesApi)
Creates an annotation date formatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Date
parse(Formats.DateTime annotation, String text, Locale locale)
Binds the field - constructs a concrete value from submitted data.String
print(Formats.DateTime annotation, Date value, Locale locale)
Unbinds this field - converts a concrete value to plain string
-
-
-
Constructor Detail
-
AnnotationDateFormatter
public AnnotationDateFormatter(MessagesApi messagesApi)
Creates an annotation date formatter.- Parameters:
messagesApi
- messages to look up the pattern
-
-
Method Detail
-
parse
public Date parse(Formats.DateTime annotation, String text, Locale locale) throws ParseException
Binds the field - constructs a concrete value from submitted data.- Specified by:
parse
in classFormatters.AnnotationFormatter<Formats.DateTime,Date>
- Parameters:
annotation
- the annotation that triggered this formattertext
- the field textlocale
- the currentLocale
- Returns:
- a new value
- Throws:
ParseException
- when the text could not be parsed
-
print
public String print(Formats.DateTime annotation, Date value, Locale locale)
Unbinds this field - converts a concrete value to plain string- Specified by:
print
in classFormatters.AnnotationFormatter<Formats.DateTime,Date>
- Parameters:
annotation
- the annotation that triggered this formattervalue
- the value to unbindlocale
- the currentLocale
- Returns:
- printable version of the value
-
-