play.data.format
Class Formatters.AnnotationFormatter<A extends java.lang.annotation.Annotation,T>

java.lang.Object
  extended by play.data.format.Formatters.AnnotationFormatter<A,T>
Direct Known Subclasses:
Formats.AnnotationDateFormatter, Formats.AnnotationNonEmptyFormatter
Enclosing class:
Formatters

public abstract static class Formatters.AnnotationFormatter<A extends java.lang.annotation.Annotation,T>
extends java.lang.Object

Super-type for annotation-based formatters.


Constructor Summary
Formatters.AnnotationFormatter()
           
 
Method Summary
abstract  T parse(A annotation, java.lang.String text, java.util.Locale locale)
          Binds the field - constructs a concrete value from submitted data.
abstract  java.lang.String print(A annotation, T value, java.util.Locale locale)
          Unbind this field (ie.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Formatters.AnnotationFormatter

public Formatters.AnnotationFormatter()
Method Detail

parse

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

Parameters:
annotation - the annotation that trigerred this formatter
text - the field text
locale - the current Locale
Returns:
a new value
Throws:
java.text.ParseException

print

public abstract java.lang.String print(A annotation,
                                       T value,
                                       java.util.Locale locale)
Unbind this field (ie. transform a concrete value to plain string)

Parameters:
annotation - the annotation that trigerred this formatter.
value - the value to unbind
locale - the current Locale
Returns:
printable version of the value