Package org.springframework.beans

Examples of org.springframework.beans.PropertyValue


   * @see #isAllowed(String)
   */
  protected void checkAllowedFields(MutablePropertyValues mpvs) {
    PropertyValue[] pvs = mpvs.getPropertyValues();
    for (int i = 0; i < pvs.length; i++) {
      PropertyValue pv = pvs[i];
      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 " +
View Full Code Here


    String[] requiredFields = getRequiredFields();
    if (!ObjectUtils.isEmpty(requiredFields)) {
      Map propertyValues = new HashMap();
      PropertyValue[] pvs = mpvs.getPropertyValues();
      for (int i = 0; i < pvs.length; i++) {
        PropertyValue pv = pvs[i];
        String canonicalName = PropertyAccessorUtils.canonicalPropertyName(pv.getName());
        propertyValues.put(canonicalName, pv);
      }
      for (int i = 0; i < requiredFields.length; i++) {
        String field = requiredFields[i];
        PropertyValue pv = (PropertyValue) propertyValues.get(field);
        if (pv == null || pv.getValue() == null ||
            (pv.getValue() instanceof String && !StringUtils.hasText((String) pv.getValue()))) {
          // Use bind error processor to create FieldError.
          getBindingErrorProcessor().processMissingFieldError(field, getInternalBindingResult());
          // Remove property from property values to bind:
          // It has already caused a field error with a rejected value.
          if (pv != null) {
View Full Code Here

      if (bd.getPropertyValues().contains(propertyName)) {
        error("Multiple 'property' definitions for property '" + propertyName + "'", ele);
        return;
      }
      Object val = parsePropertyValue(ele, bd, propertyName);
      PropertyValue pv = new PropertyValue(propertyName, val);
      parseMetaElements(ele, pv);
      pv.setSource(extractSource(ele));
      bd.getPropertyValues().addPropertyValue(pv);
    }
    finally {
      this.parseState.pop();
    }
View Full Code Here

      Enumeration en = config.getInitParameterNames();
      while (en.hasMoreElements()) {
        String property = (String) en.nextElement();
        Object value = config.getInitParameter(property);
        addPropertyValue(new PropertyValue(property, value));
        if (missingProps != null) {
          missingProps.remove(property);
        }
      }
View Full Code Here

  protected void checkFieldMarkers(MutablePropertyValues mpvs) {
    if (getFieldMarkerPrefix() != null) {
      String fieldMarkerPrefix = getFieldMarkerPrefix();
      PropertyValue[] pvArray = mpvs.getPropertyValues();
      for (int i = 0; i < pvArray.length; i++) {
        PropertyValue pv = pvArray[i];
        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.addPropertyValue(field, getEmptyValue(field, fieldType));
          }
          mpvs.removePropertyValue(pv);
View Full Code Here

      Enumeration en = config.getInitParameterNames();
      while (en.hasMoreElements()) {
        String property = (String) en.nextElement();
        Object value = config.getInitParameter(property);
        addPropertyValue(new PropertyValue(property, value));
        if (missingProps != null) {
          missingProps.remove(property);
        }
      }
View Full Code Here

    BeanDefinition bd = factory.getBeanDefinition(beanName);
    while (bd.getOriginatingBeanDefinition() != null) {
      bd = bd.getOriginatingBeanDefinition();
    }
    PropertyValue pv = new PropertyValue(property, value);
    pv.setOptional(this.ignoreInvalidKeys);
    bd.getPropertyValues().addPropertyValue(pv);
  }
View Full Code Here

          pv.setConvertedValue(convertedValue);
          deepCopy.add(pv);
        }
        else {
          resolveNecessary = true;
          deepCopy.add(new PropertyValue(pv, convertedValue));
        }
      }
    }
    if (mpvs != null && !resolveNecessary) {
      mpvs.setConverted();
View Full Code Here

      Enumeration en = config.getInitParameterNames();
      while (en.hasMoreElements()) {
        String property = (String) en.nextElement();
        Object value = config.getInitParameter(property);
        addPropertyValue(new PropertyValue(property, value));
        if (missingProps != null) {
          missingProps.remove(property);
        }
      }
View Full Code Here

      if (bd.getPropertyValues().contains(propertyName)) {
        error("Multiple 'property' definitions for property '" + propertyName + "'", ele);
        return;
      }
      Object val = parsePropertyValue(ele, bd, propertyName);
      PropertyValue pv = new PropertyValue(propertyName, val);
      parseMetaElements(ele, pv);
      pv.setSource(extractSource(ele));
      bd.getPropertyValues().addPropertyValue(pv);
    }
    finally {
      this.parseState.pop();
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.PropertyValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.