/**
  * Get the last component of the path. Also works if not nested.
  *
  * @param bw BeanWrapper to work on
  * @param nestedPath property path we know is nested
  * @return last component of the path (the property on the target bean)
  */
 private String getFinalPath(BeanWrapper bw, String nestedPath) {
   if (bw == this) {
     return nestedPath;
   }
   return nestedPath.substring(
       PropertyAccessorUtils.getLastNestedPropertySeparatorIndex(nestedPath) + 1);
 }
Exemplo n.º 2
0
 /**
  * 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
  */
 protected BeanWrapperImpl getBeanWrapperForPropertyPath(String propertyPath) {
   int pos = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(propertyPath);
   // Handle nested properties recursively.
   if (pos > -1) {
     String nestedProperty = propertyPath.substring(0, pos);
     String nestedPath = propertyPath.substring(pos + 1);
     BeanWrapperImpl nestedBw = getNestedBeanWrapper(nestedProperty);
     return nestedBw.getBeanWrapperForPropertyPath(nestedPath);
   } else {
     return this;
   }
 }