类 DefaultFormattingConversionService
- java.lang.Object
- org.springframework.core.convert.support.GenericConversionService
- org.springframework.format.support.FormattingConversionService
- org.springframework.format.support.DefaultFormattingConversionService
- 所有已实现的接口:
Aware,EmbeddedValueResolverAware,ConversionService,ConverterRegistry,ConfigurableConversionService,FormatterRegistry
public class DefaultFormattingConversionService extends FormattingConversionService
A specialization ofFormattingConversionServiceconfigured 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 anyFormatterRegistryinstance, just asDefaultConversionServiceexposes its ownaddDefaultConvertersmethod.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.
- 从以下版本开始:
- 3.1
- 作者:
- Chris Beams, Juergen Hoeller
构造器概要
构造器 构造器 说明 DefaultFormattingConversionService()Create 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(StringValueResolver embeddedValueResolver, boolean registerDefaultFormatters)Create a newDefaultFormattingConversionServicewith the set of default converters and, based on the value ofregisterDefaultFormatters, the set of default formatters
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static voidaddDefaultFormatters(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.从类继承的方法 org.springframework.format.support.FormattingConversionService
addFormatter, addFormatterForFieldAnnotation, addFormatterForFieldType, addFormatterForFieldType, setEmbeddedValueResolver
从类继承的方法 org.springframework.core.convert.support.GenericConversionService
addConverter, addConverter, addConverter, addConverterFactory, canBypassConvert, canConvert, canConvert, convert, convert, convert, convertNullSource, getConverter, getDefaultConverter, removeConvertible, toString
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从接口继承的方法 org.springframework.core.convert.converter.ConverterRegistry
addConverter, addConverter, addConverter, addConverterFactory, removeConvertible
构造器详细资料
DefaultFormattingConversionService
public DefaultFormattingConversionService()
Create a newDefaultFormattingConversionServicewith the set of default converters and default formatters.
DefaultFormattingConversionService
public DefaultFormattingConversionService(boolean registerDefaultFormatters)
Create a newDefaultFormattingConversionServicewith the set of default converters and, based on the value ofregisterDefaultFormatters, the set of default formatters.- 参数:
registerDefaultFormatters- whether to register default formatters
DefaultFormattingConversionService
public DefaultFormattingConversionService(StringValueResolver embeddedValueResolver, boolean registerDefaultFormatters)
Create a newDefaultFormattingConversionServicewith the set of default converters and, based on the value ofregisterDefaultFormatters, the set of default formatters- 参数:
embeddedValueResolver- delegated toFormattingConversionService.setEmbeddedValueResolver(StringValueResolver)prior to callingaddDefaultFormatters(org.springframework.format.FormatterRegistry).registerDefaultFormatters- whether to register default formatters
方法详细资料
addDefaultFormatters
public 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.- 参数:
formatterRegistry- the service to register default formatters with