Class DefaultConversionService
java.lang.Object
org.springframework.core.convert.support.GenericConversionService
org.springframework.core.convert.support.DefaultConversionService
- All Implemented Interfaces:
ConversionService,ConverterRegistry,ConfigurableConversionService
A specialization of
GenericConversionService configured by default
with converters appropriate for most environments.
Designed for direct instantiation but also exposes the static
addDefaultConverters(ConverterRegistry) utility method for ad-hoc
use against any ConverterRegistry instance.
- Since:
- 3.1
- Author:
- Chris Beams, Juergen Hoeller, Stephane Nicoll
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddCollectionConverters(ConverterRegistry converterRegistry) Add common collection converters.static voidaddDefaultConverters(ConverterRegistry converterRegistry) Add converters appropriate for most environments.static ConversionServiceReturn a shared defaultConversionServiceinstance, lazily building it once needed.Methods inherited from class org.springframework.core.convert.support.GenericConversionService
addConverter, addConverter, addConverter, addConverterFactory, canBypassConvert, canConvert, canConvert, convert, convert, convertNullSource, getConverter, getDefaultConverter, removeConvertible, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.convert.ConversionService
convert
-
Constructor Details
-
DefaultConversionService
public DefaultConversionService()Create a newDefaultConversionServicewith the set of default converters.
-
-
Method Details
-
addDefaultConverters
Add converters appropriate for most environments.- Parameters:
converterRegistry- the registry of converters to add to (must also be castable to ConversionService, for example, being aConfigurableConversionService)- Throws:
ClassCastException- if the given ConverterRegistry could not be cast to a ConversionService
-
addCollectionConverters
Add common collection converters.- Parameters:
converterRegistry- the registry of converters to add to (must also be castable to ConversionService, for example, being aConfigurableConversionService)- Throws:
ClassCastException- if the given ConverterRegistry could not be cast to a ConversionService- Since:
- 4.2.3