diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionFailedException.java b/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionFailedException.java index 5846cfbade7..a80957a7f0a 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionFailedException.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionFailedException.java @@ -22,11 +22,11 @@ package org.springframework.core.convert; * @author Keith Donald * @since 3.0 */ -public class ConversionFailedException extends ConversionException { +public final class ConversionFailedException extends ConversionException { - private TypeDescriptor sourceType; + private final TypeDescriptor sourceType; - private TypeDescriptor targetType; + private final TypeDescriptor targetType; /** * Create a new conversion exception. diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java b/org.springframework.core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java index 6e7bdb89edc..7f87789e4f7 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java @@ -22,7 +22,7 @@ package org.springframework.core.convert; * @author Keith Donald * @since 3.0 */ -public class ConverterNotFoundException extends ConversionException { +public final class ConverterNotFoundException extends ConversionException { private final TypeDescriptor sourceType; diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToArrayGenericConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToArrayGenericConverter.java index 2554f8b3691..a29792901e5 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToArrayGenericConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToArrayGenericConverter.java @@ -20,9 +20,9 @@ import java.lang.reflect.Array; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; -class ArrayToArrayGenericConverter implements GenericConverter { +final class ArrayToArrayGenericConverter implements GenericConverter { - private GenericConversionService conversionService; + private final GenericConversionService conversionService; public ArrayToArrayGenericConverter(GenericConversionService conversionService) { this.conversionService = conversionService; @@ -35,7 +35,7 @@ class ArrayToArrayGenericConverter implements GenericConverter { TypeDescriptor sourceElementType = sourceType.getElementTypeDescriptor(); TypeDescriptor targetElementType = targetType.getElementTypeDescriptor(); Object target = Array.newInstance(targetElementType.getType(), Array.getLength(source)); - GenericConverter converter = conversionService.getConverter(sourceElementType, targetElementType); + GenericConverter converter = this.conversionService.getConverter(sourceElementType, targetElementType); if (converter == null) { throw new ConverterNotFoundException(sourceType, targetType); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionGenericConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionGenericConverter.java index 31edf0dfb89..645a1fab148 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionGenericConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionGenericConverter.java @@ -22,9 +22,9 @@ import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; -class ArrayToCollectionGenericConverter implements GenericConverter { +final class ArrayToCollectionGenericConverter implements GenericConverter { - private GenericConversionService conversionService; + private final GenericConversionService conversionService; public ArrayToCollectionGenericConverter(GenericConversionService conversionService) { this.conversionService = conversionService; @@ -40,7 +40,7 @@ class ArrayToCollectionGenericConverter implements GenericConverter { collection.add(Array.get(source, i)); } } else { - GenericConverter converter = conversionService.getConverter(sourceElementType, targetElementType); + GenericConverter converter = this.conversionService.getConverter(sourceElementType, targetElementType); if (converter == null) { throw new ConverterNotFoundException(sourceType, targetType); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToObjectGenericConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToObjectGenericConverter.java index 89682456f90..f8da38a3cdc 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToObjectGenericConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToObjectGenericConverter.java @@ -20,9 +20,9 @@ import java.lang.reflect.Array; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; -class ArrayToObjectGenericConverter implements GenericConverter { +final class ArrayToObjectGenericConverter implements GenericConverter { - private GenericConversionService conversionService; + private final GenericConversionService conversionService; public ArrayToObjectGenericConverter(GenericConversionService conversionService) { this.conversionService = conversionService; @@ -37,7 +37,7 @@ class ArrayToObjectGenericConverter implements GenericConverter { if (sourceElementType.isAssignableTo(targetType)) { return Array.get(source, 0); } else { - GenericConverter converter = conversionService.getConverter(sourceElementType, targetType); + GenericConverter converter = this.conversionService.getConverter(sourceElementType, targetType); if (converter == null) { throw new ConverterNotFoundException(sourceType, targetType); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CharacterToNumberFactory.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CharacterToNumberFactory.java index 1fa3eb6cbd9..896ad148f9a 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CharacterToNumberFactory.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CharacterToNumberFactory.java @@ -38,13 +38,13 @@ import org.springframework.util.NumberUtils; * @see java.math.BigDecimal * @see NumberUtils */ -class CharacterToNumberFactory implements ConverterFactory { +final class CharacterToNumberFactory implements ConverterFactory { public Converter getConverter(Class targetType) { return new CharacterToNumber(targetType); } - private static class CharacterToNumber implements Converter { + private static final class CharacterToNumber implements Converter { private final Class targetType; @@ -53,7 +53,7 @@ class CharacterToNumberFactory implements ConverterFactory { } public T convert(Character source) { - return NumberUtils.convertNumberToTargetClass((short) source.charValue(), targetType); + return NumberUtils.convertNumberToTargetClass((short) source.charValue(), this.targetType); } } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayGenericConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayGenericConverter.java index 5560a99bc23..369093e155b 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayGenericConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayGenericConverter.java @@ -22,9 +22,9 @@ import java.util.Iterator; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; -class CollectionToArrayGenericConverter implements GenericConverter { +final class CollectionToArrayGenericConverter implements GenericConverter { - private GenericConversionService conversionService; + private final GenericConversionService conversionService; public CollectionToArrayGenericConverter(GenericConversionService conversionService) { this.conversionService = conversionService; @@ -44,7 +44,7 @@ class CollectionToArrayGenericConverter implements GenericConverter { Array.set(array, i, it.next()); } } else { - GenericConverter converter = conversionService.getConverter(sourceElementType, targetElementType); + GenericConverter converter = this.conversionService.getConverter(sourceElementType, targetElementType); if (converter == null) { throw new ConverterNotFoundException(sourceType, targetType); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionGenericConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionGenericConverter.java index 1b995236519..b36295050ab 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionGenericConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionGenericConverter.java @@ -21,9 +21,9 @@ import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; -class CollectionToCollectionGenericConverter implements GenericConverter { +final class CollectionToCollectionGenericConverter implements GenericConverter { - private GenericConversionService conversionService; + private final GenericConversionService conversionService; public CollectionToCollectionGenericConverter(GenericConversionService conversionService) { this.conversionService = conversionService; @@ -46,7 +46,7 @@ class CollectionToCollectionGenericConverter implements GenericConverter { } } Collection targetCollection = CollectionFactory.createCollection(targetType.getType(), sourceCollection.size()); - GenericConverter converter = conversionService.getConverter(sourceElementType, targetElementType); + GenericConverter converter = this.conversionService.getConverter(sourceElementType, targetElementType); if (converter == null) { throw new ConverterNotFoundException(sourceType, targetType); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectGenericConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectGenericConverter.java index 8727597aaeb..10f30c8f77e 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectGenericConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectGenericConverter.java @@ -20,9 +20,9 @@ import java.util.Collection; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; -class CollectionToObjectGenericConverter implements GenericConverter { +final class CollectionToObjectGenericConverter implements GenericConverter { - private GenericConversionService conversionService; + private final GenericConversionService conversionService; public CollectionToObjectGenericConverter(GenericConversionService conversionService) { this.conversionService = conversionService; @@ -37,7 +37,7 @@ class CollectionToObjectGenericConverter implements GenericConverter { if (sourceElementType == TypeDescriptor.NULL || sourceElementType.isAssignableTo(targetType)) { return sourceCollection.iterator().next(); } else { - GenericConverter converter = conversionService.getConverter(sourceElementType, targetType); + GenericConverter converter = this.conversionService.getConverter(sourceElementType, targetType); if (converter == null) { throw new ConverterNotFoundException(sourceType, targetType); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java index aaa9d235df6..74d4029c283 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java @@ -151,7 +151,7 @@ public class GenericConversionService implements ConversionService, ConverterReg } public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { - Assert.notNull(sourceType, "The source type to convert to is required"); + Assert.notNull(sourceType, "The sourceType to convert to is required"); Assert.notNull(targetType, "The targetType to convert to is required"); if (source == null) { return convertNull(sourceType, targetType); @@ -344,7 +344,7 @@ public class GenericConversionService implements ConversionService, ConverterReg Map sourceMap = sourceTypeConverters.get(sourceType); if (sourceMap == null) { sourceMap = new HashMap(); - sourceTypeConverters.put(sourceType, sourceMap); + this.sourceTypeConverters.put(sourceType, sourceMap); } return sourceMap; } @@ -410,7 +410,7 @@ public class GenericConversionService implements ConversionService, ConverterReg } public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { - return converter.convert(source); + return this.converter.convert(source); } } @@ -424,7 +424,7 @@ public class GenericConversionService implements ConversionService, ConverterReg } public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { - return converterFactory.getConverter(targetType.getObjectType()).convert(source); + return this.converterFactory.getConverter(targetType.getObjectType()).convert(source); } } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapGenericConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapGenericConverter.java index eed7ab9bf07..05c73358e25 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapGenericConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapGenericConverter.java @@ -6,9 +6,9 @@ import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; -class MapToMapGenericConverter implements GenericConverter { +final class MapToMapGenericConverter implements GenericConverter { - private GenericConversionService conversionService; + private final GenericConversionService conversionService; public MapToMapGenericConverter(GenericConversionService conversionService) { this.conversionService = conversionService; @@ -114,7 +114,7 @@ class MapToMapGenericConverter implements GenericConverter { public Object convertKey(Object sourceKey) { if (sourceKey != null && this.keyConverter != null) { - return this.keyConverter.convert(sourceKey, sourceKeyType, targetKeyType); + return this.keyConverter.convert(sourceKey, this.sourceKeyType, this.targetKeyType); } else { return sourceKey; } @@ -122,7 +122,7 @@ class MapToMapGenericConverter implements GenericConverter { public Object convertValue(Object sourceValue) { if (sourceValue != null && this.valueConverter != null) { - return this.valueConverter.convert(sourceValue, sourceValueType, targetValueType); + return this.valueConverter.convert(sourceValue, this.sourceValueType, this.targetValueType); } else { return sourceValue; } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/NumberToCharacterConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/NumberToCharacterConverter.java index 11aae0001be..b272abc6fad 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/NumberToCharacterConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/NumberToCharacterConverter.java @@ -32,7 +32,7 @@ import org.springframework.core.convert.converter.Converter; * @see java.lang.Double * @see java.math.BigDecimal */ -class NumberToCharacterConverter implements Converter { +final class NumberToCharacterConverter implements Converter { public Character convert(Number source) { return (char) source.shortValue(); diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/NumberToNumberConverterFactory.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/NumberToNumberConverterFactory.java index bff2d0b6993..9192d0d6b8b 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/NumberToNumberConverterFactory.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/NumberToNumberConverterFactory.java @@ -38,13 +38,13 @@ import org.springframework.util.NumberUtils; * @see java.math.BigDecimal * @see NumberUtils */ -class NumberToNumberConverterFactory implements ConverterFactory { +final class NumberToNumberConverterFactory implements ConverterFactory { public Converter getConverter(Class targetType) { return new NumberToNumber(targetType); } - private static class NumberToNumber implements Converter { + private final static class NumberToNumber implements Converter { private final Class targetType; @@ -53,7 +53,7 @@ class NumberToNumberConverterFactory implements ConverterFactory } public T convert(Number source) { - return NumberUtils.convertNumberToTargetClass(source, targetType); + return NumberUtils.convertNumberToTargetClass(source, this.targetType); } } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToArrayGenericConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToArrayGenericConverter.java index da820d80bc2..8e6cfc6541d 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToArrayGenericConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToArrayGenericConverter.java @@ -20,9 +20,9 @@ import java.lang.reflect.Array; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; -class ObjectToArrayGenericConverter implements GenericConverter { +final class ObjectToArrayGenericConverter implements GenericConverter { - private GenericConversionService conversionService; + private final GenericConversionService conversionService; public ObjectToArrayGenericConverter(GenericConversionService conversionService) { this.conversionService = conversionService; @@ -34,7 +34,7 @@ class ObjectToArrayGenericConverter implements GenericConverter { if (sourceType.isAssignableTo(targetElementType)) { Array.set(target, 0, source); } else { - GenericConverter converter = conversionService.getConverter(sourceType, targetElementType); + GenericConverter converter = this.conversionService.getConverter(sourceType, targetElementType); if (converter == null) { throw new ConverterNotFoundException(sourceType, targetType); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionGenericConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionGenericConverter.java index 7d8a8cedc21..24549490687 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionGenericConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionGenericConverter.java @@ -21,9 +21,9 @@ import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; -class ObjectToCollectionGenericConverter implements GenericConverter { +final class ObjectToCollectionGenericConverter implements GenericConverter { - private GenericConversionService conversionService; + private final GenericConversionService conversionService; public ObjectToCollectionGenericConverter(GenericConversionService conversionService) { this.conversionService = conversionService; @@ -35,7 +35,7 @@ class ObjectToCollectionGenericConverter implements GenericConverter { if (targetElementType == TypeDescriptor.NULL || sourceType.isAssignableTo(targetElementType)) { target.add(source); } else { - GenericConverter converter = conversionService.getConverter(sourceType, targetElementType); + GenericConverter converter = this.conversionService.getConverter(sourceType, targetElementType); if (converter == null) { throw new ConverterNotFoundException(sourceType, targetType); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToStringConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToStringConverter.java index b5c6904e55d..b9fa55dcc6e 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToStringConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToStringConverter.java @@ -26,7 +26,7 @@ import org.springframework.core.convert.converter.Converter; * @author Keith Donald * @since 3.0 */ -class ObjectToStringConverter implements Converter { +final class ObjectToStringConverter implements Converter { public String convert(Object source) { return source.toString(); diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToBooleanConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToBooleanConverter.java index 2c32a5f67b3..77610d45edf 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToBooleanConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToBooleanConverter.java @@ -24,7 +24,7 @@ import org.springframework.core.convert.converter.Converter; * @author Keith Donald * @since 3.0 */ -class StringToBooleanConverter implements Converter { +final class StringToBooleanConverter implements Converter { public Boolean convert(String source) { if (source.equals("")) { diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToCharacterConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToCharacterConverter.java index 1279abf062a..9d1a875022d 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToCharacterConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToCharacterConverter.java @@ -24,7 +24,7 @@ import org.springframework.core.convert.converter.Converter; * @author Keith Donald * @since 3.0 */ -class StringToCharacterConverter implements Converter { +final class StringToCharacterConverter implements Converter { public Character convert(String source) { if ("".equals(source)) { diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java index 774d1c5255b..dec8e09153c 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToEnumConverterFactory.java @@ -26,7 +26,7 @@ import org.springframework.core.convert.converter.ConverterFactory; * @since 3.0 */ @SuppressWarnings("unchecked") -class StringToEnumConverterFactory implements ConverterFactory { +final class StringToEnumConverterFactory implements ConverterFactory { public Converter getConverter(Class targetType) { return new StringToEnum(targetType); diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToLocaleConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToLocaleConverter.java index 3bcfa717059..3ca91385f4f 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToLocaleConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToLocaleConverter.java @@ -27,7 +27,7 @@ import org.springframework.util.StringUtils; * @author Keith Donald * @since 3.0 */ -class StringToLocaleConverter implements Converter { +final class StringToLocaleConverter implements Converter { public Locale convert(String source) { return StringUtils.parseLocaleString(source); diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToNumberConverterFactory.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToNumberConverterFactory.java index a09aaf64dbc..5490ba264f6 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToNumberConverterFactory.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/StringToNumberConverterFactory.java @@ -38,13 +38,13 @@ import org.springframework.util.NumberUtils; * @see java.math.BigDecimal * @see NumberUtils */ -class StringToNumberConverterFactory implements ConverterFactory { +final class StringToNumberConverterFactory implements ConverterFactory { public Converter getConverter(Class targetType) { return new StringToNumber(targetType); } - private static class StringToNumber implements Converter { + private static final class StringToNumber implements Converter { private final Class targetType; @@ -56,7 +56,7 @@ class StringToNumberConverterFactory implements ConverterFactory if ("".equals(source)) { return null; } - return NumberUtils.parseNumber(source, targetType); + return NumberUtils.parseNumber(source, this.targetType); } }