Class DefaultFormattingConversionService
java.lang.Object
org.springframework.core.convert.support.GenericConversionService
org.springframework.format.support.FormattingConversionService
org.springframework.format.support.DefaultFormattingConversionService
- All Implemented Interfaces:
- Aware, EmbeddedValueResolverAware, ConversionService, ConverterRegistry, ConfigurableConversionService, FormatterRegistry
A specialization of 
FormattingConversionService configured by default with
converters and formatters appropriate for most applications.
Designed for direct instantiation but also exposes the static addDefaultFormatters(FormatterRegistry)
utility method for ad hoc use against any FormatterRegistry instance, just
as DefaultConversionService exposes its own
addDefaultConverters method.
Automatically registers formatters for JSR-354 Money & Currency and JSR-310 Date-Time depending on the presence of the corresponding API on the classpath.
- Since:
- 3.1
- Author:
- Chris Beams, Juergen Hoeller
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a newDefaultFormattingConversionServicewith the set of default converters and default formatters.DefaultFormattingConversionService(boolean registerDefaultFormatters) Create a newDefaultFormattingConversionServicewith the set of default converters and, based on the value ofregisterDefaultFormatters, the set of default formatters.DefaultFormattingConversionService(@Nullable StringValueResolver embeddedValueResolver, boolean registerDefaultFormatters) Create a newDefaultFormattingConversionServicewith the set of default converters and, based on the value ofregisterDefaultFormatters, the set of default formatters.
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidaddDefaultFormatters(FormatterRegistry formatterRegistry) Add formatters appropriate for most environments: including number formatters, JSR-354 Money & Currency formatters, and JSR-310 Date-Time formatters, depending on the presence of the corresponding API on the classpath.Methods inherited from class FormattingConversionServiceaddFormatter, addFormatterForFieldAnnotation, addFormatterForFieldType, addFormatterForFieldType, addParser, addPrinter, setEmbeddedValueResolverMethods inherited from class GenericConversionServiceaddConverter, addConverter, addConverter, addConverterFactory, canBypassConvert, canConvert, canConvert, convert, convert, convertNullSource, getConverter, getDefaultConverter, removeConvertible, toStringMethods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ConversionServiceconvertMethods inherited from interface ConverterRegistryaddConverter, addConverter, addConverter, addConverterFactory, removeConvertible
- 
Constructor Details- 
DefaultFormattingConversionServicepublic DefaultFormattingConversionService()Create a newDefaultFormattingConversionServicewith the set of default converters and default formatters.
- 
DefaultFormattingConversionServicepublic DefaultFormattingConversionService(boolean registerDefaultFormatters) Create a newDefaultFormattingConversionServicewith the set of default converters and, based on the value ofregisterDefaultFormatters, the set of default formatters.- Parameters:
- registerDefaultFormatters- whether to register default formatters
 
- 
DefaultFormattingConversionServicepublic DefaultFormattingConversionService(@Nullable StringValueResolver embeddedValueResolver, boolean registerDefaultFormatters) Create a newDefaultFormattingConversionServicewith the set of default converters and, based on the value ofregisterDefaultFormatters, the set of default formatters.- Parameters:
- embeddedValueResolver- delegated to- FormattingConversionService.setEmbeddedValueResolver(StringValueResolver)prior to calling- addDefaultFormatters(FormatterRegistry).
- registerDefaultFormatters- whether to register default formatters
 
 
- 
- 
Method Details- 
addDefaultFormattersAdd formatters appropriate for most environments: including number formatters, JSR-354 Money & Currency formatters, and JSR-310 Date-Time formatters, depending on the presence of the corresponding API on the classpath.- Parameters:
- formatterRegistry- the service to register default formatters with
 
 
-