From 8a691590041eb8295d48f27e84e0e08a160a711e Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 25 Jan 2016 20:33:26 +0100 Subject: [PATCH] ConverterRegistry's addConverter declares generic type variables Issue: SPR-12948 --- .../core/convert/converter/ConverterRegistry.java | 13 +++++++------ .../convert/support/DefaultConversionService.java | 5 ++--- .../convert/support/GenericConversionService.java | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/ConverterRegistry.java b/spring-core/src/main/java/org/springframework/core/convert/converter/ConverterRegistry.java index 9280c4eac3..7541d55089 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/ConverterRegistry.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/ConverterRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,18 +27,19 @@ public interface ConverterRegistry { /** * Add a plain converter to this registry. - * The convertible sourceType/targetType pair is derived from the Converter's parameterized types. + * The convertible source/target type pair is derived from the Converter's parameterized types. * @throws IllegalArgumentException if the parameterized types could not be resolved */ void addConverter(Converter converter); /** * Add a plain converter to this registry. - * The convertible sourceType/targetType pair is specified explicitly. - * Allows for a Converter to be reused for multiple distinct pairs without having to create a Converter class for each pair. + * The convertible source/target type pair is specified explicitly. + *

Allows for a Converter to be reused for multiple distinct pairs without + * having to create a Converter class for each pair. * @since 3.1 */ - void addConverter(Class sourceType, Class targetType, Converter converter); + void addConverter(Class sourceType, Class targetType, Converter converter); /** * Add a generic converter to this registry. @@ -47,7 +48,7 @@ public interface ConverterRegistry { /** * Add a ranged converter factory to this registry. - * The convertible sourceType/rangeType pair is derived from the ConverterFactory's parameterized types. + * The convertible source/target type pair is derived from the ConverterFactory's parameterized types. * @throws IllegalArgumentException if the parameterized types could not be resolved. */ void addConverterFactory(ConverterFactory converterFactory); diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java b/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java index 408d1367b5..57c742b88c 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -141,8 +141,7 @@ public class DefaultConversionService extends GenericConversionService { converterRegistry.addConverter(Boolean.class, String.class, new ObjectToStringConverter()); converterRegistry.addConverterFactory(new StringToEnumConverterFactory()); - converterRegistry.addConverter(Enum.class, String.class, - new EnumToStringConverter((ConversionService) converterRegistry)); + converterRegistry.addConverter(new EnumToStringConverter((ConversionService) converterRegistry)); converterRegistry.addConverter(new StringToLocaleConverter()); converterRegistry.addConverter(Locale.class, String.class, new ObjectToStringConverter()); diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java b/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java index 52df6a7766..30293fc01e 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,7 +103,7 @@ public class GenericConversionService implements ConfigurableConversionService { } @Override - public void addConverter(Class sourceType, Class targetType, Converter converter) { + public void addConverter(Class sourceType, Class targetType, Converter converter) { addConverter(new ConverterAdapter( converter, ResolvableType.forClass(sourceType), ResolvableType.forClass(targetType))); }