@ -752,17 +752,17 @@ public final class CustomPropertyEditorRegistrar implements PropertyEditorRegist
@@ -752,17 +752,17 @@ public final class CustomPropertyEditorRegistrar implements PropertyEditorRegist
<title>Spring 3 Type Conversion</title>
<para>
Spring 3 introduces a <filename>core.convert</filename> package that provides a general type conversion system.
The system defines an API to implement type conversion logic, as well as an API to execute type conversions at runtime.
Within a Spring container, if configured, this system can be used as an alternative to PropertyEditors to convert externalized bean property value strings to required property types.
The system defines an SPI to implement type conversion logic, as well as an API to execute type conversions at runtime.
Within a Spring container, this system can be used as an alternative to PropertyEditors to convert externalized bean property value strings to required property types.
The public API may also be used anywhere in your application where type conversion is needed.
</para>
<sectionid="core-convert-Converter-API">
<title>Converter API</title>
<title>Converter SPI</title>
<para>
The API to implement type conversion logic is simple and strongly typed:
The SPI to implement type conversion logic is simple and strongly typed:
public class StringToInteger implements Converter<String, Integer> {
final class StringToInteger implements Converter<String, Integer> {
public Integer convert(String source) {
return Integer.valueOf(source);
@ -795,10 +796,10 @@ public class StringToInteger implements Converter<String, Integer> {
@@ -795,10 +796,10 @@ public class StringToInteger implements Converter<String, Integer> {
<sectionid="core-convert-ConverterFactory-SPI">
<title>ConverterFactory</title>
<para>
When you need to centralize the conversion logic for an entire class hierarchy, for example, when converting from String to java.lang.Enum objects, implement a <interfacename>ConverterFactory</interfacename>:
When you need to centralize the conversion logic for an entire class hierarchy, for example, when converting from String to java.lang.Enum objects, implement <interfacename>ConverterFactory</interfacename>:
Most ConversionService implementations also implement <interface>ConverterRegistry</interface>, which provides an SPI for registering converters.
Internally, a ConversionService implementation delegates to its registered Converters and ConverterFactories to carry out type conversion logic.
Internally, a ConversionService implementation delegates to its registered converters to carry out type conversion logic.
</para>
<para>
Two ConversionService implementations are provided with the system in the <filename>core.convert.support</filename> package.
<classname>GenericConversionService</classname> is a generic implementation designed to be explicitly configured, either programatically or declaratively as a Spring bean.
<classname>DefaultConversionService</classname> is a subclass that pre-registers the common Converters in the <filename>core.converter</filename> package as a convenience.
A robust ConversionService implementation is provided in the <filename>core.convert.support</filename> package.
<classname>GenericConversionService</classname> is the general-purpose implementation suitable for use in most environments.
<classname>ConversionServiceFactory</classname> provides a convenient factory for creating common ConversionService configurations.
</para>
</section>
<sectionid="core-convert-Spring-config">
@ -871,16 +938,18 @@ public interface ConversionService {
@@ -871,16 +938,18 @@ public interface ConversionService {
</para>
</note>
<para>
To register the DefaultConversionService with Spring, simply configure it as a bean with the id <code>conversionService</code>:
To register a default ConversionService with Spring, add the following bean definition with id <code>conversionService</code>: