本文整理汇总了Java中org.springframework.beans.PropertyAccessorUtils.canonicalPropertyName方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyAccessorUtils.canonicalPropertyName方法的具体用法?Java PropertyAccessorUtils.canonicalPropertyName怎么用?Java PropertyAccessorUtils.canonicalPropertyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.PropertyAccessorUtils
的用法示例。
在下文中一共展示了PropertyAccessorUtils.canonicalPropertyName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkAllowedFields
import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的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");
}
}
}
}
示例2: doSetNestedPath
import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
/**
* Actually set the nested path.
* Delegated to by setNestedPath and pushNestedPath.
* <p/>
* Note: Not yet known what to use the path for. Possibly if the Asset has
* second class Asset contained inside it.
*
* @param nestedPath Path
*/
protected void doSetNestedPath(String nestedPath) {
if (nestedPath == null) {
nestedPath = "";
}
nestedPath = PropertyAccessorUtils.canonicalPropertyName(nestedPath);
if (nestedPath.length() > 0 && !nestedPath.endsWith(NESTED_PATH_SEPARATOR)) {
nestedPath += NESTED_PATH_SEPARATOR;
}
this.nestedPath = nestedPath;
}
示例3: fixedField
import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
/**
* Transform the given field into its full path,
* regarding the nested path of this instance.
*
* @param field a {@link java.lang.String} object.
* @return {@link java.lang.String} object.
*/
protected String fixedField(String field) {
if (StringUtils.hasLength(field)) {
return getNestedPath() + PropertyAccessorUtils.canonicalPropertyName(field);
} else {
String path = getNestedPath();
return (path.endsWith(org.springframework.validation.Errors.NESTED_PATH_SEPARATOR) ?
path.substring(0, path.length() - NESTED_PATH_SEPARATOR.length()) : path);
}
}
示例4: PropertyPath
import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
/**
* <p>Constructor for PropertyPath.</p>
*
* @param nestedPath a {@link java.lang.String} object.
*/
public PropertyPath(String nestedPath) {
String canonicalPath = PropertyAccessorUtils.canonicalPropertyName(nestedPath);
int lastIndex = PropertyAccessorUtils.getLastNestedPropertySeparatorIndex(canonicalPath);
if (lastIndex < 0) {
propertyName = PropertyAccessorUtils.getPropertyName(canonicalPath);
key = computeKey(canonicalPath);
}
else {
parent = new PropertyPath(canonicalPath.substring(0, lastIndex));
String lastProperty = canonicalPath.substring(lastIndex+1);
propertyName = PropertyAccessorUtils.getPropertyName(lastProperty);
key = computeKey(lastProperty);
}
}
示例5: canonicalFieldName
import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
/**
* Returns the canonical property name.
* @see org.springframework.beans.PropertyAccessorUtils#canonicalPropertyName
*/
@Override
protected String canonicalFieldName(String field) {
return PropertyAccessorUtils.canonicalPropertyName(field);
}