Esempio n. 1
0
 /**
  * Add a PropertyValue object, replacing any existing one for the respective property.
  *
  * @param pv PropertyValue object to add
  */
 public void addPropertyValue(PropertyValue pv) {
   for (int i = 0; i < this.propertyValueList.size(); i++) {
     PropertyValue currentPv = (PropertyValue) this.propertyValueList.get(i);
     if (currentPv.getName().equals(pv.getName())) {
       setPropertyValueAt(pv, i);
       return;
     }
   }
   this.propertyValueList.add(pv);
   recache();
 }
Esempio n. 2
0
  public PropertyValues changesSince(PropertyValues old) {
    MutablePropertyValues changes = new MutablePropertyValues();
    if (old == this) return changes;

    // for each property value in the new set
    for (int i = 0; i < this.propertyValueArray.length; i++) {
      PropertyValue newPv = propertyValueArray[i];
      // if there wasn't an old one, add it
      PropertyValue pvOld = old.getPropertyValue(newPv.getName());
      if (pvOld == null) {
        changes.addPropertyValue(newPv);
      } else if (!pvOld.equals(newPv)) {
        // it's changed
        changes.addPropertyValue(newPv);
      }
    }
    return changes;
  }
Esempio n. 3
0
 @Override
 public void setPropertyValue(PropertyValue pv) throws BeansException {
   PropertyTokenHolder tokens = (PropertyTokenHolder) pv.resolvedTokens;
   if (tokens == null) {
     String propertyName = pv.getName();
     BeanWrapperImpl nestedBw;
     try {
       nestedBw = getBeanWrapperForPropertyPath(propertyName);
     } catch (NotReadablePropertyException ex) {
       throw new NotWritablePropertyException(
           getRootClass(),
           this.nestedPath + propertyName,
           "Nested property in path '" + propertyName + "' does not exist",
           ex);
     }
     tokens = getPropertyNameTokens(getFinalPath(nestedBw, propertyName));
     if (nestedBw == this) {
       pv.getOriginalPropertyValue().resolvedTokens = tokens;
     }
     nestedBw.setPropertyValue(tokens, pv);
   } else {
     setPropertyValue(tokens, pv);
   }
 }
 public void setPropertyValue(PropertyValue pv) throws BeansException {
   setPropertyValue(pv.getName(), pv.getValue());
 }