本文整理汇总了Java中org.springframework.beans.PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex方法的具体用法?Java PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex怎么用?Java PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.PropertyAccessorUtils
的用法示例。
在下文中一共展示了PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBeanWrapperForPropertyPath
import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
/**
* Overridden to copy property editor registration to the new bean wrapper.
*
* <p>This is necessary because spring only copies over the editors when a new bean wrapper is
* created. The wrapper is then cached and use for subsequent calls. But the get calls could bring in
* new custom editors we need to copy.</p>
*
* {@inheritDoc}
*/
@Override
protected BeanWrapperImpl getBeanWrapperForPropertyPath(String propertyPath) {
BeanWrapperImpl beanWrapper = super.getBeanWrapperForPropertyPath(propertyPath);
PropertyTokenHolder tokens = getPropertyNameTokens(propertyPath);
String canonicalName = tokens.canonicalName;
int pos = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(canonicalName);
if (pos != -1) {
canonicalName = canonicalName.substring(0, pos);
}
copyCustomEditorsTo(beanWrapper, canonicalName);
return beanWrapper;
}
示例2: getBeanWrapperForPropertyPath
import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
@Override
protected BeanWrapperImpl getBeanWrapperForPropertyPath(String propertyPath) {
BeanWrapperImpl beanWrapper = super.getBeanWrapperForPropertyPath(propertyPath);
PropertyTokenHolder tokens = getPropertyNameTokens(propertyPath);
String canonicalName = tokens.canonicalName;
int pos = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(canonicalName);
if (pos != -1) {
canonicalName = canonicalName.substring(0, pos);
}
copyCustomEditorsTo(beanWrapper, canonicalName);
return beanWrapper;
}
示例3: getPropertyDescriptorForPropertyPath
import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
/**
* Recursively navigate to return a BeanWrapper for the nested property path.
*
* @param propertyPath
* property property path, which may be nested
* @return a BeanWrapper for the target bean
*/
PropertyDescriptor getPropertyDescriptorForPropertyPath(String propertyPath, Class<?> propertyType) {
int pos = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(propertyPath);
// Handle nested properties recursively.
if (pos > -1) {
String nestedProperty = propertyPath.substring(0, pos);
String nestedPath = propertyPath.substring(pos + 1);
PropertyDescriptor propertyDescriptor = BeanUtils.getPropertyDescriptor(propertyType, nestedProperty);
// BeanWrapperImpl nestedBw = getNestedBeanWrapper(nestedProperty);
return getPropertyDescriptorForPropertyPath(nestedPath, propertyDescriptor.getPropertyType());
} else {
return BeanUtils.getPropertyDescriptor(propertyType, propertyPath);
}
}