From 7635e7b7f2a39d735daea940af331c19aca730a1 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 28 Nov 2014 20:32:35 +0100 Subject: [PATCH] Polishing Issue: SPR-12483 --- .../core/convert/support/ArrayToArrayConverter.java | 5 +++-- .../core/convert/support/ArrayToObjectConverter.java | 7 +++++-- .../core/convert/support/ArrayToStringConverter.java | 6 +++--- .../core/convert/support/ObjectToArrayConverter.java | 8 +++++--- .../convert/support/StringToEnumConverterFactory.java | 7 ++++--- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java index bdad578fc5d..df3b730d11b 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToArrayConverter.java @@ -27,8 +27,9 @@ import org.springframework.core.convert.converter.ConditionalGenericConverter; import org.springframework.util.ObjectUtils; /** - * Converts an Array to another Array. First adapts the source array to a List, then - * delegates to {@link CollectionToArrayConverter} to perform the target array conversion. + * Converts an array to another array. First adapts the source array to a List, + * then delegates to {@link CollectionToArrayConverter} to perform the target + * array conversion. * * @author Keith Donald * @author Phillip Webb diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java index 78d2f93548e..ef92f0bd120 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToObjectConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -25,7 +25,8 @@ import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.converter.ConditionalGenericConverter; /** - * Converts an Array to an Object by returning the first array element after converting it to the desired targetType. + * Converts an array to an Object by returning the first array element + * after converting it to the desired target type. * * @author Keith Donald * @since 3.0 @@ -34,10 +35,12 @@ final class ArrayToObjectConverter implements ConditionalGenericConverter { private final ConversionService conversionService; + public ArrayToObjectConverter(ConversionService conversionService) { this.conversionService = conversionService; } + @Override public Set getConvertibleTypes() { return Collections.singleton(new ConvertiblePair(Object[].class, Object.class)); diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToStringConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToStringConverter.java index ff9db8ef3f2..80f986a6e44 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToStringConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ArrayToStringConverter.java @@ -26,9 +26,9 @@ import org.springframework.core.convert.converter.ConditionalGenericConverter; import org.springframework.util.ObjectUtils; /** - * Converts an Array to a comma-delimited String. - * This implementation first adapts the source Array to a List, - * then delegates to {@link CollectionToStringConverter} to perform the target String conversion. + * Converts an array to a comma-delimited String. First adapts the source array + * to a List, then delegates to {@link CollectionToStringConverter} to perform + * the target String conversion. * * @author Keith Donald * @since 3.0 diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToArrayConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToArrayConverter.java index bf64daf8923..1531926a9e8 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToArrayConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/ObjectToArrayConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -25,8 +25,8 @@ import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.converter.ConditionalGenericConverter; /** - * Converts an Object to a single-element Array containing the Object. - * Will convert the Object to the target Array's component type if necessary. + * Converts an Object to a single-element array containing the Object. + * Will convert the Object to the target array's component type if necessary. * * @author Keith Donald * @since 3.0 @@ -35,10 +35,12 @@ final class ObjectToArrayConverter implements ConditionalGenericConverter { private final ConversionService conversionService; + public ObjectToArrayConverter(ConversionService conversionService) { this.conversionService = conversionService; } + @Override public Set getConvertibleTypes() { return Collections.singleton(new ConvertiblePair(Object.class, Object[].class)); diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java b/spring-core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java index 7fec5eb48f8..923239b919e 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java @@ -20,12 +20,12 @@ import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.converter.ConverterFactory; /** - * Converts from a String to a java.lang.Enum by calling {@link Enum#valueOf(Class, String)}. + * Converts from a String to a {@link java.lang.Enum} by calling {@link Enum#valueOf(Class, String)}. * * @author Keith Donald * @since 3.0 */ -@SuppressWarnings({ "unchecked", "rawtypes" }) +@SuppressWarnings({"unchecked", "rawtypes"}) final class StringToEnumConverterFactory implements ConverterFactory { @Override @@ -35,7 +35,8 @@ final class StringToEnumConverterFactory implements ConverterFactory