public class DefaultConversionService extends GenericConversionService
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.
Constructor and Description |
---|
DefaultConversionService()
Create a new
DefaultConversionService with the set of
default converters. |
Modifier and Type | Method and Description |
---|---|
static void |
addCollectionConverters(ConverterRegistry converterRegistry)
Add common collection converters.
|
static void |
addDefaultConverters(ConverterRegistry converterRegistry)
Add converters appropriate for most environments.
|
static ConversionService |
getSharedInstance()
Return a shared default
ConversionService instance,
lazily building it once needed. |
addConverter, addConverter, addConverter, addConverterFactory, canBypassConvert, canConvert, canConvert, convert, convert, convert, convertNullSource, getConverter, getDefaultConverter, removeConvertible, toString
public DefaultConversionService()
DefaultConversionService
with the set of
default converters.public static ConversionService getSharedInstance()
ConversionService
instance,
lazily building it once needed.
NOTE: We highly recommend constructing individual
ConversionService
instances for customization purposes.
This accessor is only meant as a fallback for code paths which
need simple type coercion but cannot access a longer-lived
ConversionService
instance any other way.
ConversionService
instance (never null
)public static void addDefaultConverters(ConverterRegistry converterRegistry)
converterRegistry
- the registry of converters to add to
(must also be castable to ConversionService, e.g. being a ConfigurableConversionService
)ClassCastException
- if the given ConverterRegistry could not be cast to a ConversionServicepublic static void addCollectionConverters(ConverterRegistry converterRegistry)
converterRegistry
- the registry of converters to add to
(must also be castable to ConversionService, e.g. being a ConfigurableConversionService
)ClassCastException
- if the given ConverterRegistry could not be cast to a ConversionService