Class Formatters.AnnotationFormatter<A extends Annotation,T>

java.lang.Object
play.data.format.Formatters.AnnotationFormatter<A,T>
Type Parameters:
A - the type of the annotation
T - 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 Details

    • AnnotationFormatter

      public AnnotationFormatter()
  • Method Details

    • 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 formatter
      text - the field text
      locale - the current Locale
      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 unbind
      locale - the current Locale
      Returns:
      printable version of the value