/** * Check the given property values against the allowed fields, * removing values for fields that are not allowed. * @param mpvs the property values to be bound (can be modified) * @see #getAllowedFields * @see #isAllowed(String) */ protected void checkAllowedFields(MutablePropertyValues mpvs) { PropertyValue[] pvs = mpvs.getPropertyValues(); for (PropertyValue pv : pvs) { String field = PropertyAccessorUtils.canonicalPropertyName(pv.getName()); if (!isAllowed(field)) { mpvs.removePropertyValue(pv); getBindingResult().recordSuppressedField(field); if (logger.isDebugEnabled()) { logger.debug("Field [" + field + "] has been removed from PropertyValues " + "and will not be bound, because it has not been found in the list of allowed fields"); } } } }
mpvs.removePropertyValue(pv); propertyValues.remove(field);
/** * Check the given property values for field defaults, * i.e. for fields that start with the field default prefix. * <p>The existence of a field defaults indicates that the specified * value should be used if the field is otherwise not present. * @param mpvs the property values to be bound (can be modified) * @see #getFieldDefaultPrefix */ protected void checkFieldDefaults(MutablePropertyValues mpvs) { String fieldDefaultPrefix = getFieldDefaultPrefix(); if (fieldDefaultPrefix != null) { PropertyValue[] pvArray = mpvs.getPropertyValues(); for (PropertyValue pv : pvArray) { if (pv.getName().startsWith(fieldDefaultPrefix)) { String field = pv.getName().substring(fieldDefaultPrefix.length()); if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) { mpvs.add(field, pv.getValue()); } mpvs.removePropertyValue(pv); } } } }
/** * Check the given property values against the allowed fields, * removing values for fields that are not allowed. * @param mpvs the property values to be bound (can be modified) * @see #getAllowedFields * @see #isAllowed(String) */ protected void checkAllowedFields(MutablePropertyValues mpvs) { PropertyValue[] pvs = mpvs.getPropertyValues(); for (PropertyValue pv : pvs) { String field = PropertyAccessorUtils.canonicalPropertyName(pv.getName()); if (!isAllowed(field)) { mpvs.removePropertyValue(pv); getBindingResult().recordSuppressedField(field); if (logger.isDebugEnabled()) { logger.debug("Field [" + field + "] has been removed from PropertyValues " + "and will not be bound, because it has not been found in the list of allowed fields"); } } } }
/** * Check the given property values for field markers, * i.e. for fields that start with the field marker prefix. * <p>The existence of a field marker indicates that the specified * field existed in the form. If the property values do not contain * a corresponding field value, the field will be considered as empty * and will be reset appropriately. * @param mpvs the property values to be bound (can be modified) * @see #getFieldMarkerPrefix * @see #getEmptyValue(String, Class) */ protected void checkFieldMarkers(MutablePropertyValues mpvs) { String fieldMarkerPrefix = getFieldMarkerPrefix(); if (fieldMarkerPrefix != null) { PropertyValue[] pvArray = mpvs.getPropertyValues(); for (PropertyValue pv : pvArray) { if (pv.getName().startsWith(fieldMarkerPrefix)) { String field = pv.getName().substring(fieldMarkerPrefix.length()); if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) { Class<?> fieldType = getPropertyAccessor().getPropertyType(field); mpvs.add(field, getEmptyValue(field, fieldType)); } mpvs.removePropertyValue(pv); } } } }
mpvs.removePropertyValue(pv); propertyValues.remove(field);
/** * Check the given property values for field defaults, * i.e. for fields that start with the field default prefix. * <p>The existence of a field defaults indicates that the specified * value should be used if the field is otherwise not present. * @param mpvs the property values to be bound (can be modified) * @see #getFieldDefaultPrefix */ protected void checkFieldDefaults(MutablePropertyValues mpvs) { String fieldDefaultPrefix = getFieldDefaultPrefix(); if (fieldDefaultPrefix != null) { PropertyValue[] pvArray = mpvs.getPropertyValues(); for (PropertyValue pv : pvArray) { if (pv.getName().startsWith(fieldDefaultPrefix)) { String field = pv.getName().substring(fieldDefaultPrefix.length()); if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) { mpvs.add(field, pv.getValue()); } mpvs.removePropertyValue(pv); } } } }
/** * Check the given property values for field markers, * i.e. for fields that start with the field marker prefix. * <p>The existence of a field marker indicates that the specified * field existed in the form. If the property values do not contain * a corresponding field value, the field will be considered as empty * and will be reset appropriately. * @param mpvs the property values to be bound (can be modified) * @see #getFieldMarkerPrefix * @see #getEmptyValue(String, Class) */ protected void checkFieldMarkers(MutablePropertyValues mpvs) { String fieldMarkerPrefix = getFieldMarkerPrefix(); if (fieldMarkerPrefix != null) { PropertyValue[] pvArray = mpvs.getPropertyValues(); for (PropertyValue pv : pvArray) { if (pv.getName().startsWith(fieldMarkerPrefix)) { String field = pv.getName().substring(fieldMarkerPrefix.length()); if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) { Class<?> fieldType = getPropertyAccessor().getPropertyType(field); mpvs.add(field, getEmptyValue(field, fieldType)); } mpvs.removePropertyValue(pv); } } } }
(Object[]) propertyValue.getValue())); args.add(new RuntimeBeanReference(optionBeanId)); properties.removePropertyValue("arguments"); properties.addPropertyValue("arguments", args);
(Object[]) propertyValue.getValue())); args.add(new RuntimeBeanReference(optionBeanId)); properties.removePropertyValue("arguments"); properties.addPropertyValue("arguments", args);
for (String propName : this.ignoredUnknownProperties) { if (pvs.contains(propName) && !bw.isWritableProperty(propName)) { pvs.removePropertyValue(propName);
for (String propName : this.ignoredUnknownProperties) { if (pvs.contains(propName) && !bw.isWritableProperty(propName)) { pvs.removePropertyValue(propName);
@Override public void removePropertyValue(String propertyName) { beanDefinition.getPropertyValues().removePropertyValue(propertyName); }
/** * Overloaded version of removePropertyValue that takes a property name. * @param propertyName name of the property * @see #removePropertyValue(PropertyValue) */ public void removePropertyValue(String propertyName) { removePropertyValue(getPropertyValue(propertyName)); }
private void initCheckbox(Element ele, MutablePropertyValues pvs) { pvs.removePropertyValue("default"); if ("checked".equals(XmlUtils.getAttribute(ele, "default"))) { pvs.addPropertyValue("checkedByDefault", Boolean.TRUE); } }
protected void removeOldPropertyIfNeeded(@Nonnull BeanAndPropertyName beanAndPropertyName, @Nonnull MutablePropertyValues propertyValues) { final PropertyValue propertyValue = propertyValues.getPropertyValue(beanAndPropertyName.getPropertyName()); if (propertyValue != null) { propertyValues.removePropertyValue(propertyValue); } }
private void copyProps(BeanDefinitionBuilder src, BeanDefinition def) { for (PropertyValue v : src.getBeanDefinition().getPropertyValues().getPropertyValues()) { if (!"bus".equals(v.getName())) { def.getPropertyValues().addPropertyValue(v.getName(), v.getValue()); } src.getBeanDefinition().getPropertyValues().removePropertyValue(v); } }
private void copyProps(BeanDefinitionBuilder src, BeanDefinition def) { for (PropertyValue v : src.getBeanDefinition().getPropertyValues().getPropertyValues()) { if (!"bus".equals(v.getName())) { def.getPropertyValues().addPropertyValue(v.getName(), v.getValue()); } src.getBeanDefinition().getPropertyValues().removePropertyValue(v); } }
private void copyProps(BeanDefinitionBuilder src, BeanDefinition def) { for (PropertyValue v : src.getBeanDefinition().getPropertyValues().getPropertyValues()) { if (!"bus".equals(v.getName())) { def.getPropertyValues().addPropertyValue(v.getName(), v.getValue()); } src.getBeanDefinition().getPropertyValues().removePropertyValue(v); } }
private void copyProps(BeanDefinitionBuilder src, BeanDefinition def) { for (PropertyValue v : src.getBeanDefinition().getPropertyValues().getPropertyValues()) { if (!"bus".equals(v.getName())) { def.getPropertyValues().addPropertyValue(v.getName(), v.getValue()); } src.getBeanDefinition().getPropertyValues().removePropertyValue(v); } }