made ConversionExecutor internal; removed other unused operations from public SPI

This commit is contained in:
Keith Donald
2009-05-11 21:23:18 +00:00
parent bf7a947559
commit d7c90cff14
16 changed files with 109 additions and 142 deletions

View File

@@ -17,7 +17,7 @@
package org.springframework.expression.spel.support;
import org.springframework.core.convert.ConversionException;
import org.springframework.core.convert.ConversionExecutorNotFoundException;
import org.springframework.core.convert.ConverterNotFoundException;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.service.DefaultConversionService;
@@ -53,7 +53,7 @@ public class StandardTypeConverter implements TypeConverter {
public Object convertValue(Object value, TypeDescriptor typeDescriptor) throws EvaluationException {
try {
return conversionService.executeConversion(value, typeDescriptor);
} catch (ConversionExecutorNotFoundException cenfe) {
} catch (ConverterNotFoundException cenfe) {
throw new SpelException(cenfe, SpelMessages.TYPE_CONVERSION_ERROR, value.getClass(), typeDescriptor.asString());
} catch (ConversionException ce) {
throw new SpelException(ce, SpelMessages.TYPE_CONVERSION_ERROR, value.getClass(), typeDescriptor.asString());

View File

@@ -19,7 +19,6 @@ package org.springframework.expression.spel;
import java.util.ArrayList;
import java.util.List;
import org.springframework.core.convert.ConversionExecutor;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.service.DefaultConversionService;
import org.springframework.core.convert.service.GenericConversionService;
@@ -65,17 +64,14 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas
// ArrayList containing List<Integer> to List<String>
Class<?> clazz = typeDescriptorForListOfString.getElementType();
assertEquals(String.class,clazz);
ConversionExecutor executor = tcs.getConversionExecutor(ArrayList.class, typeDescriptorForListOfString);
assertNotNull(executor);
List l = (List)executor.execute(listOfInteger);
List l = (List) tcs.executeConversion(listOfInteger, typeDescriptorForListOfString);
assertNotNull(l);
// ArrayList containing List<String> to List<Integer>
clazz = typeDescriptorForListOfInteger.getElementType();
assertEquals(Integer.class,clazz);
executor = tcs.getConversionExecutor(ArrayList.class, typeDescriptorForListOfInteger);
assertNotNull(executor);
l = (List)executor.execute(listOfString);
l = (List) tcs.executeConversion(listOfString, typeDescriptorForListOfString);
assertNotNull(l);
}