Class Formatters.SimpleFormatter<T>

java.lang.Object
play.data.format.Formatters.SimpleFormatter<T>
Type Parameters:
T - the type that this formatter will parse and print
Direct Known Subclasses:
Formats.DateFormatter
Enclosing class:
Formatters

public abstract static class Formatters.SimpleFormatter<T> extends Object
Super-type for custom simple formatters.
  • Constructor Details

    • SimpleFormatter

      public SimpleFormatter()
  • Method Details

    • parse

      public abstract T parse(String text, Locale locale) throws ParseException
      Binds the field - constructs a concrete value from submitted data.
      Parameters:
      text - the field text
      locale - the current Locale
      Returns:
      a new value
      Throws:
      ParseException - if the text could not be parsed into T
    • print

      public abstract String print(T t, Locale locale)
      Unbinds this field - transforms a concrete value to plain string.
      Parameters:
      t - the value to unbind
      locale - the current Locale
      Returns:
      printable version of the value