类 ApplicationConversionService
java.lang.Object
org.springframework.core.convert.support.GenericConversionService
org.springframework.format.support.FormattingConversionService
org.springframework.boot.convert.ApplicationConversionService
- 所有已实现的接口:
Aware,EmbeddedValueResolverAware,ConversionService,ConverterRegistry,ConfigurableConversionService,FormatterRegistry
A specialization of
FormattingConversionService configured by default with
converters and formatters appropriate for most Spring Boot applications.
Designed for direct instantiation but also exposes the static
addApplicationConverters(org.springframework.core.convert.converter.ConverterRegistry) and
addApplicationFormatters(FormatterRegistry) utility methods for ad-hoc use
against registry instance.
- 从以下版本开始:
- 2.0.0
- 作者:
- Phillip Webb, Shixiong Guo
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static voidaddApplicationConverters(ConverterRegistry registry) Add converters useful for most Spring Boot applications.static voidaddApplicationFormatters(FormatterRegistry registry) Add formatters useful for most Spring Boot applications.static voidaddBeans(FormatterRegistry registry, ListableBeanFactory beanFactory) AddPrinter,Parser,Formatter,Converter,ConverterFactory,GenericConverter, and beans from the specified bean factory.addBeans(FormatterRegistry registry, ListableBeanFactory beanFactory, String qualifier) AddPrinter,Parser,Formatter,Converter,ConverterFactory,GenericConverter, and beans from the specified bean factory.<S,T> void addConverter(Class<S> sourceType, Class<T> targetType, Converter<? super S, ? extends T> converter) voidaddConverter(Converter<?, ?> converter) voidaddConverter(GenericConverter converter) voidaddConverterFactory(ConverterFactory<?, ?> factory) static voidAdd converters to support delimited strings.voidaddFormatter(Formatter<?> formatter) voidaddFormatterForFieldAnnotation(AnnotationFormatterFactory<? extends Annotation> annotationFormatterFactory) voidaddFormatterForFieldType(Class<?> fieldType, Formatter<?> formatter) voidaddFormatterForFieldType(Class<?> fieldType, Printer<?> printer, Parser<?> parser) voidvoidaddPrinter(Printer<?> printer) static voidconfigure(FormatterRegistry registry) Configure the givenFormatterRegistrywith formatters and converters appropriate for most Spring Boot applications.static ConversionServiceReturn a shared default applicationConversionServiceinstance, lazily building it once needed.booleanisConvertViaObjectSourceType(TypeDescriptor sourceType, TypeDescriptor targetType) Returntrueif objects ofsourceTypecan be converted to thetargetTypeand the converter hasObject.classas a supported source type.voidremoveConvertible(Class<?> sourceType, Class<?> targetType) 从类继承的方法 org.springframework.format.support.FormattingConversionService
setEmbeddedValueResolver从类继承的方法 org.springframework.core.convert.support.GenericConversionService
canBypassConvert, canConvert, canConvert, convert, convert, convertNullSource, getConverter, getDefaultConverter, toString从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait从接口继承的方法 org.springframework.core.convert.ConversionService
convert
-
构造器详细资料
-
ApplicationConversionService
public ApplicationConversionService() -
ApplicationConversionService
-
-
方法详细资料
-
addPrinter
- 指定者:
addPrinter在接口中FormatterRegistry- 覆盖:
addPrinter在类中FormattingConversionService
-
addParser
- 指定者:
addParser在接口中FormatterRegistry- 覆盖:
addParser在类中FormattingConversionService
-
addFormatter
- 指定者:
addFormatter在接口中FormatterRegistry- 覆盖:
addFormatter在类中FormattingConversionService
-
addFormatterForFieldType
-
addConverter
- 指定者:
addConverter在接口中ConverterRegistry- 覆盖:
addConverter在类中GenericConversionService
-
addFormatterForFieldType
-
addFormatterForFieldAnnotation
public void addFormatterForFieldAnnotation(AnnotationFormatterFactory<? extends Annotation> annotationFormatterFactory) -
addConverter
public <S,T> void addConverter(Class<S> sourceType, Class<T> targetType, Converter<? super S, ? extends T> converter) - 指定者:
addConverter在接口中ConverterRegistry- 覆盖:
addConverter在类中GenericConversionService
-
addConverter
- 指定者:
addConverter在接口中ConverterRegistry- 覆盖:
addConverter在类中GenericConversionService
-
addConverterFactory
- 指定者:
addConverterFactory在接口中ConverterRegistry- 覆盖:
addConverterFactory在类中GenericConversionService
-
removeConvertible
- 指定者:
removeConvertible在接口中ConverterRegistry- 覆盖:
removeConvertible在类中GenericConversionService
-
isConvertViaObjectSourceType
Returntrueif objects ofsourceTypecan be converted to thetargetTypeand the converter hasObject.classas a supported source type.- 参数:
sourceType- the source type to testtargetType- the target type to test- 返回:
- if conversion happens through an
ObjectTo...converter - 从以下版本开始:
- 2.4.3
-
configure
Configure the givenFormatterRegistrywith formatters and converters appropriate for most Spring Boot applications.- 参数:
registry- the registry of converters to add to (must also be castable to ConversionService, e.g. being aConfigurableConversionService)- 抛出:
ClassCastException- if the given FormatterRegistry could not be cast to a ConversionService
-
addApplicationConverters
Add converters useful for most Spring Boot applications.- 参数:
registry- the registry of converters to add to (must also be castable to ConversionService, e.g. being aConfigurableConversionService)- 抛出:
ClassCastException- if the given ConverterRegistry could not be cast to a ConversionService
-
addDelimitedStringConverters
Add converters to support delimited strings.- 参数:
registry- the registry of converters to add to (must also be castable to ConversionService, e.g. being aConfigurableConversionService)- 抛出:
ClassCastException- if the given ConverterRegistry could not be cast to a ConversionService
-
addApplicationFormatters
Add formatters useful for most Spring Boot applications.- 参数:
registry- the service to register default formatters with
-
addBeans
AddPrinter,Parser,Formatter,Converter,ConverterFactory,GenericConverter, and beans from the specified bean factory.- 参数:
registry- the service to register beans withbeanFactory- the bean factory to get the beans from- 从以下版本开始:
- 2.2.0
-
addBeans
public static Map<String,Object> addBeans(FormatterRegistry registry, ListableBeanFactory beanFactory, String qualifier) AddPrinter,Parser,Formatter,Converter,ConverterFactory,GenericConverter, and beans from the specified bean factory.- 参数:
registry- the service to register beans withbeanFactory- the bean factory to get the beans fromqualifier- the qualifier required on the beans ornull- 返回:
- the beans that were added
- 从以下版本开始:
- 3.5.0
-