play.data.format
Class Formats.DateFormatter

java.lang.Object
  extended by play.data.format.Formatters.SimpleFormatter<java.util.Date>
      extended by play.data.format.Formats.DateFormatter
Enclosing class:
Formats

public static class Formats.DateFormatter
extends Formatters.SimpleFormatter<java.util.Date>

Formatter for java.util.Date values.


Constructor Summary
Formats.DateFormatter(java.lang.String pattern)
          Creates a date formatter.
 
Method Summary
 java.util.Date parse(java.lang.String text, java.util.Locale locale)
          Binds the field - constructs a concrete value from submitted data.
 java.lang.String print(java.util.Date value, java.util.Locale locale)
          Unbinds this fields - converts a concrete value to a plain string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Formats.DateFormatter

public Formats.DateFormatter(java.lang.String pattern)
Creates a date formatter.

Parameters:
pattern - date pattern, as specified for SimpleDateFormat.
Method Detail

parse

public java.util.Date parse(java.lang.String text,
                            java.util.Locale locale)
                     throws java.text.ParseException
Binds the field - constructs a concrete value from submitted data.

Specified by:
parse in class Formatters.SimpleFormatter<java.util.Date>
Parameters:
text - the field text
locale - the current Locale
Returns:
a new value
Throws:
java.text.ParseException

print

public java.lang.String print(java.util.Date value,
                              java.util.Locale locale)
Unbinds this fields - converts a concrete value to a plain string.

Specified by:
print in class Formatters.SimpleFormatter<java.util.Date>
Parameters:
value - the value to unbind
locale - the current Locale
Returns:
printable version of the value