public class DefaultFormattingConversionService extends FormattingConversionService
FormattingConversionService
configured by default with
converters and formatters appropriate for most applications.
Designed for direct instantiation but also exposes the static addDefaultFormatters(org.springframework.format.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, JSR-310 Date-Time and/or Joda-Time, depending on the presence of the corresponding API on the classpath.
Constructor and Description |
---|
DefaultFormattingConversionService()
Create a new
DefaultFormattingConversionService with the set of
default converters and
default formatters. |
DefaultFormattingConversionService(boolean registerDefaultFormatters)
Create a new
DefaultFormattingConversionService with the set of
default converters and,
based on the value of registerDefaultFormatters , the set of
default formatters. |
DefaultFormattingConversionService(StringValueResolver embeddedValueResolver,
boolean registerDefaultFormatters)
Create a new
DefaultFormattingConversionService with the set of
default converters and,
based on the value of registerDefaultFormatters , the set of
default formatters. |
Modifier and Type | Method and Description |
---|---|
static void |
addDefaultFormatters(FormatterRegistry formatterRegistry)
Add formatters appropriate for most environments: including number formatters,
JSR-354 Money & Currency formatters, JSR-310 Date-Time and/or Joda-Time formatters,
depending on the presence of the corresponding API on the classpath.
|
addFormatter, addFormatterForFieldAnnotation, addFormatterForFieldType, addFormatterForFieldType, addParser, addPrinter, setEmbeddedValueResolver
addConverter, addConverter, addConverter, addConverterFactory, canBypassConvert, canConvert, canConvert, convert, convert, convert, convertNullSource, getConverter, getDefaultConverter, removeConvertible, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addConverter, addConverter, addConverter, addConverterFactory, removeConvertible
public DefaultFormattingConversionService()
DefaultFormattingConversionService
with the set of
default converters and
default formatters.public DefaultFormattingConversionService(boolean registerDefaultFormatters)
DefaultFormattingConversionService
with the set of
default converters and,
based on the value of registerDefaultFormatters
, the set of
default formatters.registerDefaultFormatters
- whether to register default formatterspublic DefaultFormattingConversionService(@Nullable StringValueResolver embeddedValueResolver, boolean registerDefaultFormatters)
DefaultFormattingConversionService
with the set of
default converters and,
based on the value of registerDefaultFormatters
, the set of
default formatters.embeddedValueResolver
- delegated to FormattingConversionService.setEmbeddedValueResolver(StringValueResolver)
prior to calling addDefaultFormatters(org.springframework.format.FormatterRegistry)
.registerDefaultFormatters
- whether to register default formatterspublic static void addDefaultFormatters(FormatterRegistry formatterRegistry)
formatterRegistry
- the service to register default formatters with