本文整理汇总了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);
}
}
}
}
示例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);
}
}
}
}
示例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");
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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