Top Description Methods
org.springframework.format

public Interface FormatterRegistry

extends ConverterRegistry
Known Direct Implementers
org.springframework.format.support.FormattingConversionService
Imports
java.lang.annotation.Annotation, org.springframework.core.convert.converter.ConverterRegistry

A registry of field formatting logic.
Authors
Keith Donald, Juergen Hoeller
Since
3.0

Method Summary

Modifier and TypeMethod and Description
public void
addFormatter(Formatter<?>
the formatter to add
formatter
)

Adds a Formatter to format fields of a specific type.

public void
addFormatterForFieldAnnotation(AnnotationFormatterFactory<? extends Annotation>
the annotation formatter factory to add
annotationFormatterFactory
)

Adds a Formatter to format fields annotated with a specific format annotation.

public void
addFormatterForFieldType(Class<?>
the field type to format
fieldType
,
Formatter<?>
the formatter to add
formatter
)

Adds a Formatter to format fields of the given type.

public void
addFormatterForFieldType(Class<?>
the field type to format
fieldType
,
Printer<?>
the printing part of the formatter
printer
,
Parser<?>
the parsing part of the formatter
parser
)

Adds a Printer/Parser pair to format fields of a specific type.

public void
addParser(Parser<?>
the parser to add
parser
)

Adds a Parser to parse fields of a specific type.

public void
addPrinter(Printer<?>
the printer to add
printer
)

Adds a Printer to print fields of a specific type.

Inherited from org.springframework.core.convert.converter.ConverterRegistry:
addConverteraddConverteraddConverteraddConverterFactoryremoveConvertible

Method Detail

addFormatterback to summary
public void addFormatter(Formatter<?> formatter)

Adds a Formatter to format fields of a specific type. The field type is implied by the parameterized Formatter instance.

Parameters
formatter:Formatter<?>

the formatter to add

Since
3.1
See Also
addFormatterForFieldType(Class, Formatter)
addFormatterForFieldAnnotationback to summary
public void addFormatterForFieldAnnotation(AnnotationFormatterFactory<? extends Annotation> annotationFormatterFactory)

Adds a Formatter to format fields annotated with a specific format annotation.

Parameters
annotationFormatterFactory:AnnotationFormatterFactory<? extends Annotation>

the annotation formatter factory to add

addFormatterForFieldTypeback to summary
public void addFormatterForFieldType(Class<?> fieldType, Formatter<?> formatter)

Adds a Formatter to format fields of the given type.

On print, if the Formatter's type T is declared and fieldType is not assignable to T, a coercion 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 coercion to the field type will be attempted before returning the parsed field value.

Parameters
fieldType:Class<?>

the field type to format

formatter:Formatter<?>

the formatter to add

addFormatterForFieldTypeback to summary
public void addFormatterForFieldType(Class<?> fieldType, Printer<?> printer, Parser<?> parser)

Adds a Printer/Parser pair to format fields of a specific type. The formatter will delegate to the specified 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 coercion 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 coercion to the field type will be attempted before returning the parsed field value.

Parameters
fieldType:Class<?>

the field type to format

printer:Printer<?>

the printing part of the formatter

parser:Parser<?>

the parsing part of the formatter

addParserback to summary
public void addParser(Parser<?> parser)

Adds a Parser to parse fields of a specific type. The field type is implied by the parameterized Parser instance.

Parameters
parser:Parser<?>

the parser to add

Since
5.2
See Also
addFormatter(Formatter)
addPrinterback to summary
public void addPrinter(Printer<?> printer)

Adds a Printer to print fields of a specific type. The field type is implied by the parameterized Printer instance.

Parameters
printer:Printer<?>

the printer to add

Since
5.2
See Also
addFormatter(Formatter)