|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FormatterRegistry
A registry of field formatting logic.
Method Summary | |
---|---|
void |
addFormatter(Formatter<?> formatter)
Adds a Formatter to format fields of a specific type. |
void |
addFormatterForFieldAnnotation(AnnotationFormatterFactory<? extends Annotation> annotationFormatterFactory)
Adds a Formatter to format fields annotated with a specific format annotation. |
void |
addFormatterForFieldType(Class<?> fieldType,
Formatter<?> formatter)
Adds a Formatter to format fields of the given type. |
void |
addFormatterForFieldType(Class<?> fieldType,
Printer<?> printer,
Parser<?> parser)
Adds a Printer/Parser pair to format fields of a specific type. |
Methods inherited from interface org.springframework.core.convert.converter.ConverterRegistry |
---|
addConverter, addConverter, addConverter, addConverterFactory, removeConvertible |
Method Detail |
---|
void addFormatter(Formatter<?> formatter)
formatter
- the formatter to addaddFormatterForFieldType(Class, Formatter)
void addFormatterForFieldType(Class<?> fieldType, Formatter<?> formatter)
On print, if the Formatter's type T is declared and fieldType
is not assignable to T,
a coersion to T will be attempted before delegating to formatter
to print a field value.
On parse, if the parsed object returned by formatter
is not assignable to the runtime field type,
a coersion to the field type will be attempted before returning the parsed field value.
fieldType
- the field type to formatformatter
- the formatter to addvoid addFormatterForFieldType(Class<?> fieldType, Printer<?> printer, Parser<?> parser)
printer
for printing
and the specified parser
for parsing.
On print, if the Printer's type T is declared and fieldType
is not assignable to T,
a coersion to T will be attempted before delegating to printer
to print a field value.
On parse, if the object returned by the Parser is not assignable to the runtime field type,
a coersion to the field type will be attempted before returning the parsed field value.
fieldType
- the field type to formatprinter
- the printing part of the formatterparser
- the parsing part of the formattervoid addFormatterForFieldAnnotation(AnnotationFormatterFactory<? extends Annotation> annotationFormatterFactory)
annotationFormatterFactory
- the annotation formatter factory to add
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |