javadoc and final

This commit is contained in:
Keith Donald 2009-09-21 22:35:39 +00:00
parent 01e900c33a
commit e9416db472
21 changed files with 51 additions and 51 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -38,13 +38,13 @@ import org.springframework.util.NumberUtils;
* @see java.math.BigDecimal
* @see NumberUtils
*/
class CharacterToNumberFactory implements ConverterFactory<Character, Number> {
final class CharacterToNumberFactory implements ConverterFactory<Character, Number> {
public <T extends Number> Converter<Character, T> getConverter(Class<T> targetType) {
return new CharacterToNumber<T>(targetType);
}
private static class CharacterToNumber<T extends Number> implements Converter<Character, T> {
private static final class CharacterToNumber<T extends Number> implements Converter<Character, T> {
private final Class<T> targetType;
@ -53,7 +53,7 @@ class CharacterToNumberFactory implements ConverterFactory<Character, Number> {
}
public T convert(Character source) {
return NumberUtils.convertNumberToTargetClass((short) source.charValue(), targetType);
return NumberUtils.convertNumberToTargetClass((short) source.charValue(), this.targetType);
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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<Class, GenericConverter> sourceMap = sourceTypeConverters.get(sourceType);
if (sourceMap == null) {
sourceMap = new HashMap<Class, GenericConverter>();
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);
}
}

View File

@ -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;
}

View File

@ -32,7 +32,7 @@ import org.springframework.core.convert.converter.Converter;
* @see java.lang.Double
* @see java.math.BigDecimal
*/
class NumberToCharacterConverter implements Converter<Number, Character> {
final class NumberToCharacterConverter implements Converter<Number, Character> {
public Character convert(Number source) {
return (char) source.shortValue();

View File

@ -38,13 +38,13 @@ import org.springframework.util.NumberUtils;
* @see java.math.BigDecimal
* @see NumberUtils
*/
class NumberToNumberConverterFactory implements ConverterFactory<Number, Number> {
final class NumberToNumberConverterFactory implements ConverterFactory<Number, Number> {
public <T extends Number> Converter<Number, T> getConverter(Class<T> targetType) {
return new NumberToNumber<T>(targetType);
}
private static class NumberToNumber<T extends Number> implements Converter<Number, T> {
private final static class NumberToNumber<T extends Number> implements Converter<Number, T> {
private final Class<T> targetType;
@ -53,7 +53,7 @@ class NumberToNumberConverterFactory implements ConverterFactory<Number, Number>
}
public T convert(Number source) {
return NumberUtils.convertNumberToTargetClass(source, targetType);
return NumberUtils.convertNumberToTargetClass(source, this.targetType);
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -26,7 +26,7 @@ import org.springframework.core.convert.converter.Converter;
* @author Keith Donald
* @since 3.0
*/
class ObjectToStringConverter implements Converter<Object, String> {
final class ObjectToStringConverter implements Converter<Object, String> {
public String convert(Object source) {
return source.toString();

View File

@ -24,7 +24,7 @@ import org.springframework.core.convert.converter.Converter;
* @author Keith Donald
* @since 3.0
*/
class StringToBooleanConverter implements Converter<String, Boolean> {
final class StringToBooleanConverter implements Converter<String, Boolean> {
public Boolean convert(String source) {
if (source.equals("")) {

View File

@ -24,7 +24,7 @@ import org.springframework.core.convert.converter.Converter;
* @author Keith Donald
* @since 3.0
*/
class StringToCharacterConverter implements Converter<String, Character> {
final class StringToCharacterConverter implements Converter<String, Character> {
public Character convert(String source) {
if ("".equals(source)) {

View File

@ -26,7 +26,7 @@ import org.springframework.core.convert.converter.ConverterFactory;
* @since 3.0
*/
@SuppressWarnings("unchecked")
class StringToEnumConverterFactory implements ConverterFactory<String, Enum> {
final class StringToEnumConverterFactory implements ConverterFactory<String, Enum> {
public <T extends Enum> Converter<String, T> getConverter(Class<T> targetType) {
return new StringToEnum(targetType);

View File

@ -27,7 +27,7 @@ import org.springframework.util.StringUtils;
* @author Keith Donald
* @since 3.0
*/
class StringToLocaleConverter implements Converter<String, Locale> {
final class StringToLocaleConverter implements Converter<String, Locale> {
public Locale convert(String source) {
return StringUtils.parseLocaleString(source);

View File

@ -38,13 +38,13 @@ import org.springframework.util.NumberUtils;
* @see java.math.BigDecimal
* @see NumberUtils
*/
class StringToNumberConverterFactory implements ConverterFactory<String, Number> {
final class StringToNumberConverterFactory implements ConverterFactory<String, Number> {
public <T extends Number> Converter<String, T> getConverter(Class<T> targetType) {
return new StringToNumber<T>(targetType);
}
private static class StringToNumber<T extends Number> implements Converter<String, T> {
private static final class StringToNumber<T extends Number> implements Converter<String, T> {
private final Class<T> targetType;
@ -56,7 +56,7 @@ class StringToNumberConverterFactory implements ConverterFactory<String, Number>
if ("".equals(source)) {
return null;
}
return NumberUtils.parseNumber(source, targetType);
return NumberUtils.parseNumber(source, this.targetType);
}
}