fixed getPropertyTypeDescriptor to work for nested indexed property as well as for array property (SPR-6710)
This commit is contained in:
parent
5abd3b99b9
commit
081d81e5b0
|
|
@ -355,7 +355,8 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||||
|
|
||||||
public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException {
|
public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException {
|
||||||
try {
|
try {
|
||||||
PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
|
String actualPropertyName = PropertyAccessorUtils.getPropertyName(propertyName);
|
||||||
|
PropertyDescriptor pd = getPropertyDescriptorInternal(actualPropertyName);
|
||||||
if (pd != null) {
|
if (pd != null) {
|
||||||
Class type = getPropertyType(propertyName);
|
Class type = getPropertyType(propertyName);
|
||||||
if (pd.getReadMethod() != null) {
|
if (pd.getReadMethod() != null) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2008 the original author or authors.
|
* Copyright 2002-2010 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -32,7 +32,8 @@ public abstract class PropertyAccessorUtils {
|
||||||
* @return the actual property name, without any key elements
|
* @return the actual property name, without any key elements
|
||||||
*/
|
*/
|
||||||
public static String getPropertyName(String propertyPath) {
|
public static String getPropertyName(String propertyPath) {
|
||||||
int separatorIndex = propertyPath.indexOf(PropertyAccessor.PROPERTY_KEY_PREFIX_CHAR);
|
int separatorIndex = (propertyPath.endsWith(PropertyAccessor.PROPERTY_KEY_SUFFIX) ?
|
||||||
|
propertyPath.indexOf(PropertyAccessor.PROPERTY_KEY_PREFIX_CHAR) : -1);
|
||||||
return (separatorIndex != -1 ? propertyPath.substring(0, separatorIndex) : propertyPath);
|
return (separatorIndex != -1 ? propertyPath.substring(0, separatorIndex) : propertyPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue