类 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
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static void
addApplicationConverters
(ConverterRegistry registry) Add converters useful for most Spring Boot applications.static void
addApplicationFormatters
(FormatterRegistry registry) Add formatters useful for most Spring Boot applications.static void
addBeans
(FormatterRegistry registry, ListableBeanFactory beanFactory) <S,
T> void addConverter
(Class<S> sourceType, Class<T> targetType, Converter<? super S, ? extends T> converter) void
addConverter
(Converter<?, ?> converter) void
addConverter
(GenericConverter converter) void
addConverterFactory
(ConverterFactory<?, ?> factory) static void
Add converters to support delimited strings.void
addFormatter
(Formatter<?> formatter) void
addFormatterForFieldAnnotation
(AnnotationFormatterFactory<? extends Annotation> annotationFormatterFactory) void
addFormatterForFieldType
(Class<?> fieldType, Formatter<?> formatter) void
addFormatterForFieldType
(Class<?> fieldType, Printer<?> printer, Parser<?> parser) void
void
addPrinter
(Printer<?> printer) static void
configure
(FormatterRegistry registry) Configure the givenFormatterRegistry
with formatters and converters appropriate for most Spring Boot applications.static ConversionService
Return a shared default applicationConversionService
instance, lazily building it once needed.boolean
isConvertViaObjectSourceType
(TypeDescriptor sourceType, TypeDescriptor targetType) Returntrue
if objects ofsourceType
can be converted to thetargetType
and the converter hasObject.class
as a supported source type.void
removeConvertible
(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
Returntrue
if objects ofsourceType
can be converted to thetargetType
and the converter hasObject.class
as 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 givenFormatterRegistry
with 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
- 参数:
registry
- the service to register beans withbeanFactory
- the bean factory to get the beans from- 从以下版本开始:
- 2.2.0
-