當前位置: 首頁>>代碼示例>>Java>>正文


Java MutablePropertyValues.getPropertyValues方法代碼示例

本文整理匯總了Java中org.springframework.beans.MutablePropertyValues.getPropertyValues方法的典型用法代碼示例。如果您正苦於以下問題:Java MutablePropertyValues.getPropertyValues方法的具體用法?Java MutablePropertyValues.getPropertyValues怎麽用?Java MutablePropertyValues.getPropertyValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.beans.MutablePropertyValues的用法示例。


在下文中一共展示了MutablePropertyValues.getPropertyValues方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkFieldDefaults

import org.springframework.beans.MutablePropertyValues; //導入方法依賴的package包/類
/**
 * 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) {
	if (getFieldDefaultPrefix() != null) {
		String fieldDefaultPrefix = getFieldDefaultPrefix();
		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);
			}
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:24,代碼來源:WebDataBinder.java

示例2: checkFieldMarkers

import org.springframework.beans.MutablePropertyValues; //導入方法依賴的package包/類
/**
 * 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) {
	if (getFieldMarkerPrefix() != null) {
		String fieldMarkerPrefix = getFieldMarkerPrefix();
		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);
			}
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:28,代碼來源:WebDataBinder.java

示例3: getPropertyValuesForNamePrefix

import org.springframework.beans.MutablePropertyValues; //導入方法依賴的package包/類
private MutablePropertyValues getPropertyValuesForNamePrefix(
		MutablePropertyValues propertyValues) {
	if (!StringUtils.hasText(this.namePrefix) && !this.ignoreNestedProperties) {
		return propertyValues;
	}
	MutablePropertyValues rtn = new MutablePropertyValues();
	for (PropertyValue value : propertyValues.getPropertyValues()) {
		String name = value.getName();
		for (String prefix : new RelaxedNames(stripLastDot(this.namePrefix))) {
			for (String separator : new String[] { ".", "_" }) {
				String candidate = (StringUtils.hasLength(prefix) ? prefix + separator
						: prefix);
				if (name.startsWith(candidate)) {
					name = name.substring(candidate.length());
					if (!(this.ignoreNestedProperties && name.contains("."))) {
						PropertyOrigin propertyOrigin = OriginCapablePropertyValue
								.getOrigin(value);
						rtn.addPropertyValue(new OriginCapablePropertyValue(name,
								value.getValue(), propertyOrigin));
					}
				}
			}
		}
	}
	return rtn;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:27,代碼來源:RelaxedDataBinder.java

示例4: checkAllowedFields

import org.springframework.beans.MutablePropertyValues; //導入方法依賴的package包/類
/**
 * 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");
			}
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:DataBinder.java

示例5: visitPropertyValues

import org.springframework.beans.MutablePropertyValues; //導入方法依賴的package包/類
protected void visitPropertyValues(MutablePropertyValues pvs) {
	PropertyValue[] pvArray = pvs.getPropertyValues();
	for (PropertyValue pv : pvArray) {
		Object newVal = resolveValue(pv.getValue());
		if (!ObjectUtils.nullSafeEquals(newVal, pv.getValue())) {
			pvs.add(pv.getName(), newVal);
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:BeanDefinitionVisitor.java

示例6: shallowCloneManagedCollections

import org.springframework.beans.MutablePropertyValues; //導入方法依賴的package包/類
protected void shallowCloneManagedCollections(final AbstractBeanDefinition cloneBeanDefinition)
{
    // clone is not a deep clone - managed lists / maps are by-reference which is problematic for placeholder resolution
    final MutablePropertyValues propertyValues = cloneBeanDefinition.getPropertyValues();
    for (final PropertyValue pv : propertyValues.getPropertyValues())
    {
        final Object value = pv.getValue();
        if (value instanceof ManagedList<?>)
        {
            final ManagedList<Object> newList = new ManagedList<>();
            newList.setSource(((ManagedList<?>) value).getSource());
            newList.setElementTypeName(((ManagedList<?>) value).getElementTypeName());
            newList.addAll((ManagedList<?>) value);
            propertyValues.add(pv.getName(), newList);
        }
        else if (value instanceof ManagedSet<?>)
        {
            final ManagedSet<Object> newSet = new ManagedSet<>();
            newSet.setSource(((ManagedSet<?>) value).getSource());
            newSet.setElementTypeName(((ManagedSet<?>) value).getElementTypeName());
            newSet.addAll((ManagedSet<?>) value);
            propertyValues.add(pv.getName(), newSet);
        }
        else if (value instanceof ManagedMap<?, ?>)
        {
            final ManagedMap<Object, Object> newMap = new ManagedMap<>();
            newMap.setSource(((ManagedMap<?, ?>) value).getSource());
            newMap.setKeyTypeName(((ManagedMap<?, ?>) value).getKeyTypeName());
            newMap.setValueTypeName(((ManagedMap<?, ?>) value).getValueTypeName());
            newMap.putAll((ManagedMap<?, ?>) value);
            propertyValues.add(pv.getName(), newMap);
        }
    }
}
 
開發者ID:Acosix,項目名稱:alfresco-mt-support,代碼行數:35,代碼來源:TemplatedTenantBeanEmitter.java

示例7: addMapPrefix

import org.springframework.beans.MutablePropertyValues; //導入方法依賴的package包/類
private MutablePropertyValues addMapPrefix(MutablePropertyValues propertyValues) {
	MutablePropertyValues rtn = new MutablePropertyValues();
	for (PropertyValue pv : propertyValues.getPropertyValues()) {
		rtn.add("map." + pv.getName(), pv.getValue());
	}
	return rtn;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:8,代碼來源:RelaxedDataBinder.java


注:本文中的org.springframework.beans.MutablePropertyValues.getPropertyValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。