|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object play.data.format.Formatters
public class Formatters
Formatters helper.
Nested Class Summary | |
---|---|
static class |
Formatters.AnnotationFormatter<A extends java.lang.annotation.Annotation,T>
Super-type for annotation-based formatters. |
static class |
Formatters.SimpleFormatter<T>
Super-type for custom simple formatters. |
Field Summary | |
---|---|
static org.springframework.format.support.FormattingConversionService |
conversion
The underlying conversion service. |
Constructor Summary | |
---|---|
Formatters()
|
Method Summary | ||
---|---|---|
static
|
parse(java.lang.reflect.Field field,
java.lang.String text,
java.lang.Class<T> clazz)
Parses this string as instance of a specific field in the given class |
|
static
|
parse(java.lang.String text,
java.lang.Class<T> clazz)
Parses this string as instance of the given class. |
|
static
|
print(java.lang.reflect.Field field,
T t)
Computes the display string for any value, for a specific field. |
|
static
|
print(T t)
Computes the display string for any value. |
|
static
|
print(org.springframework.core.convert.TypeDescriptor desc,
T t)
Computes the display string for any value, for a specific type. |
|
static
|
register(java.lang.Class<T> clazz,
Formatters.AnnotationFormatter<A,T> formatter)
Registers an annotation-based formatter. |
|
static
|
register(java.lang.Class<T> clazz,
Formatters.SimpleFormatter<T> formatter)
Registers a simple formatter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.springframework.format.support.FormattingConversionService conversion
Constructor Detail |
---|
public Formatters()
Method Detail |
---|
public static <T> T parse(java.lang.String text, java.lang.Class<T> clazz)
text
- the text to parseclazz
- class representing the required type
public static <T> T parse(java.lang.reflect.Field field, java.lang.String text, java.lang.Class<T> clazz)
field
- the related field (custom formatters are extracted from this field annotation)text
- the text to parseclazz
- class representing the required type
public static <T> java.lang.String print(T t)
t
- the value to print
public static <T> java.lang.String print(java.lang.reflect.Field field, T t)
field
- the related field - custom formatters are extracted from this field annotationt
- the value to print
public static <T> java.lang.String print(org.springframework.core.convert.TypeDescriptor desc, T t)
desc
- the field descriptor - custom formatters are extracted from this descriptor.t
- the value to print
public static <T> void register(java.lang.Class<T> clazz, Formatters.SimpleFormatter<T> formatter)
clazz
- class handled by this formatterformatter
- the formatter to registerpublic static <A extends java.lang.annotation.Annotation,T> void register(java.lang.Class<T> clazz, Formatters.AnnotationFormatter<A,T> formatter)
clazz
- class handled by this formatterformatter
- the formatter to register
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |