moved generic converter to spi; added entity converter; removed various service impls in favor of service factory

This commit is contained in:
Keith Donald
2009-11-19 09:10:51 +00:00
parent 211e36c249
commit d85dc01e28
37 changed files with 418 additions and 341 deletions

View File

@@ -20,7 +20,7 @@ import org.springframework.core.convert.ConversionException;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.ConverterNotFoundException;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.expression.EvaluationException;
import org.springframework.expression.TypeConverter;
import org.springframework.expression.spel.SpelEvaluationException;
@@ -40,7 +40,7 @@ public class StandardTypeConverter implements TypeConverter {
private final ConversionService conversionService;
public StandardTypeConverter() {
this.conversionService = new DefaultConversionService();
this.conversionService = ConversionServiceFactory.createDefault();
}
public StandardTypeConverter(ConversionService conversionService) {

View File

@@ -23,8 +23,9 @@ import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.expression.EvaluationException;
import org.springframework.expression.Expression;
import org.springframework.expression.TypeConverter;
@@ -98,7 +99,7 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas
*/
private static class TypeConvertorUsingConversionService implements TypeConverter {
private final DefaultConversionService service = new DefaultConversionService();
private final ConversionService service = ConversionServiceFactory.createDefault();
public boolean canConvert(Class<?> sourceType, Class<?> targetType) {
return this.service.canConvert(sourceType, targetType);

View File

@@ -20,9 +20,7 @@ import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.expression.EvaluationException;
import org.springframework.expression.Operation;
import org.springframework.expression.OperatorOverloader;
@@ -73,7 +71,7 @@ public class StandardComponentsTests {
@Test
public void testStandardTypeConverter() throws EvaluationException {
TypeConverter tc = new StandardTypeConverter(new DefaultConversionService());
TypeConverter tc = new StandardTypeConverter();
tc.convertValue(3, TypeDescriptor.valueOf(Double.class));
}