Resolve Collection element types during conversion
TypeDescriptor.valueOf now uses GenericCollectionTypeResolver to resolve Collection and Map element types whereas previously this information was simply not supported, i.e. null. Issue: SPR-9257
This commit is contained in:
committed by
Chris Beams
parent
99b2f6a081
commit
5a1f924ac3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,8 +18,11 @@ package org.springframework.core.convert;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import org.springframework.core.GenericCollectionTypeResolver;
|
||||
|
||||
/**
|
||||
* @author Keith Donald
|
||||
* @author Phillip Webb
|
||||
* @since 3.1
|
||||
*/
|
||||
class ClassDescriptor extends AbstractDescriptor {
|
||||
@@ -34,18 +37,21 @@ class ClassDescriptor extends AbstractDescriptor {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
protected Class<?> resolveCollectionElementType() {
|
||||
return null;
|
||||
return GenericCollectionTypeResolver.getCollectionType((Class) getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
protected Class<?> resolveMapKeyType() {
|
||||
return null;
|
||||
return GenericCollectionTypeResolver.getMapKeyType((Class) getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
protected Class<?> resolveMapValueType() {
|
||||
return null;
|
||||
return GenericCollectionTypeResolver.getMapValueType((Class) getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user