spring-framework / org.springframework.format.support

Package org.springframework.format.support

Types

DefaultFormattingConversionService

open class DefaultFormattingConversionService : FormattingConversionService

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 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.

FormatterPropertyEditorAdapter

open class FormatterPropertyEditorAdapter : PropertyEditorSupport

Adapter that bridges between Formatter and PropertyEditor.

FormattingConversionService

open class FormattingConversionService : GenericConversionService, FormatterRegistry, EmbeddedValueResolverAware

A org.springframework.core.convert.ConversionService implementation designed to be configured as a FormatterRegistry.

FormattingConversionServiceFactoryBean

open class FormattingConversionServiceFactoryBean : FactoryBean<FormattingConversionService>, EmbeddedValueResolverAware, InitializingBean

A factory providing convenient access to a FormattingConversionService configured with converters and formatters for common types such as numbers and datetimes.

Additional converters and formatters can be registered declaratively through #setConverters(Set) and #setFormatters(Set). Another option is to register converters and formatters in code by implementing the FormatterRegistrar interface. You can then configure provide the set of registrars to use through #setFormatterRegistrars(Set).

A good example for registering converters and formatters in code is JodaTimeFormatterRegistrar, which registers a number of date-related formatters and converters. For a more detailed list of cases see #setFormatterRegistrars(Set)

Like all FactoryBean implementations, this class is suitable for use when configuring a Spring application context using Spring <beans> XML. When configuring the container with org.springframework.context.annotation.Configuration classes, simply instantiate, configure and return the appropriate FormattingConversionService object from a org.springframework.context.annotation.Bean method.