Package play.data.format
Class Formatters.AnnotationFormatter<A extends Annotation,T>
- Object
-
- play.data.format.Formatters.AnnotationFormatter<A,T>
-
- Type Parameters:
A- the type of the annotationT- the type that this formatter will parse and print
- Direct Known Subclasses:
Formats.AnnotationDateFormatter,Formats.AnnotationNonEmptyFormatter
- Enclosing class:
- Formatters
public abstract static class Formatters.AnnotationFormatter<A extends Annotation,T> extends Object
Super-type for annotation-based formatters.
-
-
Constructor Summary
Constructors Constructor Description AnnotationFormatter()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract Tparse(A annotation, String text, Locale locale)Binds the field - constructs a concrete value from submitted data.abstract Stringprint(A annotation, T value, Locale locale)Unbind this field (ie.
-
-
-
Method Detail
-
parse
public abstract T parse(A annotation, String text, Locale locale) throws ParseException
Binds the field - constructs a concrete value from submitted data.- 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 abstract String print(A annotation, T value, Locale locale)
Unbind this field (ie. transform a concrete value to plain string)- Parameters:
annotation- the annotation that triggered this formatter.value- the value to unbindlocale- the currentLocale- Returns:
- printable version of the value
-
-