restored TypeDescriptor getElementType, getMapKeyType, and getMapValueType compatibility; StringToCollection and Array Converters are now conditional and check targetElementType if present; TypeDesciptor#isAssignable no longer bothers with element type and map key/value types in checking assignability for consistency elsewhere; improved javadoc
This commit is contained in:
@@ -74,13 +74,13 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas
|
||||
TypeConvertorUsingConversionService tcs = new TypeConvertorUsingConversionService();
|
||||
|
||||
// ArrayList containing List<Integer> to List<String>
|
||||
Class<?> clazz = typeDescriptorForListOfString.getElementType().getType();
|
||||
Class<?> clazz = typeDescriptorForListOfString.getElementTypeDescriptor().getType();
|
||||
assertEquals(String.class,clazz);
|
||||
List l = (List) tcs.convertValue(listOfInteger, TypeDescriptor.forObject(listOfInteger), typeDescriptorForListOfString);
|
||||
assertNotNull(l);
|
||||
|
||||
// ArrayList containing List<String> to List<Integer>
|
||||
clazz = typeDescriptorForListOfInteger.getElementType().getType();
|
||||
clazz = typeDescriptorForListOfInteger.getElementTypeDescriptor().getType();
|
||||
assertEquals(Integer.class,clazz);
|
||||
|
||||
l = (List) tcs.convertValue(listOfString, TypeDescriptor.forObject(listOfString), typeDescriptorForListOfString);
|
||||
|
||||
@@ -113,7 +113,7 @@ public class SelectionAndProjectionTests {
|
||||
Object value = expression.getValue(context);
|
||||
assertTrue(value.getClass().isArray());
|
||||
TypedValue typedValue = new TypedValue(value);
|
||||
assertEquals(Integer.class, typedValue.getTypeDescriptor().getElementType().getType());
|
||||
assertEquals(Integer.class, typedValue.getTypeDescriptor().getElementTypeDescriptor().getType());
|
||||
Integer[] array = (Integer[]) value;
|
||||
assertEquals(5, array.length);
|
||||
assertEquals(new Integer(0), array[0]);
|
||||
@@ -148,7 +148,7 @@ public class SelectionAndProjectionTests {
|
||||
Object value = expression.getValue(context);
|
||||
assertTrue(value.getClass().isArray());
|
||||
TypedValue typedValue = new TypedValue(value);
|
||||
assertEquals(Integer.class, typedValue.getTypeDescriptor().getElementType().getType());
|
||||
assertEquals(Integer.class, typedValue.getTypeDescriptor().getElementTypeDescriptor().getType());
|
||||
Integer[] array = (Integer[]) value;
|
||||
assertEquals(5, array.length);
|
||||
assertEquals(new Integer(0), array[0]);
|
||||
@@ -250,7 +250,7 @@ public class SelectionAndProjectionTests {
|
||||
Object value = expression.getValue(context);
|
||||
assertTrue(value.getClass().isArray());
|
||||
TypedValue typedValue = new TypedValue(value);
|
||||
assertEquals(Number.class, typedValue.getTypeDescriptor().getElementType().getType());
|
||||
assertEquals(Number.class, typedValue.getTypeDescriptor().getElementTypeDescriptor().getType());
|
||||
Number[] array = (Number[]) value;
|
||||
assertEquals(3, array.length);
|
||||
assertEquals(new Integer(5), array[0]);
|
||||
|
||||
@@ -729,7 +729,7 @@ public class SpringEL300Tests extends ExpressionTestCase {
|
||||
// value is list containing [true,false]
|
||||
Assert.assertEquals(Boolean.class,value.get(0).getClass());
|
||||
TypeDescriptor evaluated = exp.getValueTypeDescriptor(ctx);
|
||||
Assert.assertEquals(null, evaluated.getElementType());
|
||||
Assert.assertEquals(null, evaluated.getElementTypeDescriptor());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -742,7 +742,7 @@ public class SpringEL300Tests extends ExpressionTestCase {
|
||||
// value is array containing [true,false]
|
||||
Assert.assertEquals(Boolean.class,value[0].getClass());
|
||||
TypeDescriptor evaluated = exp.getValueTypeDescriptor(ctx);
|
||||
Assert.assertEquals(Boolean.class, evaluated.getElementType().getType());
|
||||
Assert.assertEquals(Boolean.class, evaluated.getElementTypeDescriptor().getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -755,7 +755,7 @@ public class SpringEL300Tests extends ExpressionTestCase {
|
||||
// value is list containing [true,false]
|
||||
Assert.assertEquals(Boolean.class,value.get(0).getClass());
|
||||
TypeDescriptor evaluated = exp.getValueTypeDescriptor(ctx);
|
||||
Assert.assertEquals(null, evaluated.getElementType());
|
||||
Assert.assertEquals(null, evaluated.getElementTypeDescriptor());
|
||||
}
|
||||
|
||||
static class C {
|
||||
|
||||
Reference in New Issue
Block a user