当前位置: 首页>>代码示例>>Java>>正文


Java PropertyAccessorUtils.getLastNestedPropertySeparatorIndex方法代码示例

本文整理汇总了Java中org.springframework.beans.PropertyAccessorUtils.getLastNestedPropertySeparatorIndex方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyAccessorUtils.getLastNestedPropertySeparatorIndex方法的具体用法?Java PropertyAccessorUtils.getLastNestedPropertySeparatorIndex怎么用?Java PropertyAccessorUtils.getLastNestedPropertySeparatorIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.PropertyAccessorUtils的用法示例。


在下文中一共展示了PropertyAccessorUtils.getLastNestedPropertySeparatorIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: linkAddedLine

import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
/**
 * Set the parent for bi-directional relationships when adding a line to a collection.
 *
 * @param model the view data
 * @param collectionPath the path to the collection being linked
 * @param addedIndex the index of the added line
 * @return whether the linked line needs further processing
 */
protected boolean linkAddedLine(Object model, String collectionPath, int addedIndex) {
    int lastSepIndex = PropertyAccessorUtils.getLastNestedPropertySeparatorIndex(collectionPath);
    if (lastSepIndex != -1) {
        String collectionParentPath = collectionPath.substring(0, lastSepIndex);
        Object parent = ObjectPropertyUtils.getPropertyValue(model, collectionParentPath);
        if (parent != null && getDataObjectService().supports(parent.getClass())) {
            DataObjectWrapper<?> wrappedParent = getDataObjectService().wrap(parent);
            String collectionName = collectionPath.substring(lastSepIndex + 1);
            wrappedParent.linkChanges(Sets.newHashSet(collectionName + "[" + addedIndex + "]"));
        }

        // check if its edit line in dialog line action, and if it is we want to set the collection as
        // the dialog's parent and do not want further processing of the dialog object
        if (collectionParentPath.equalsIgnoreCase(UifPropertyPaths.DIALOG_DATA_OBJECT)) {
            ((UifFormBase) model).setDialogDataObject(parent);
            return false;
        }
    }
    return true;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:ViewHelperServiceImpl.java

示例2: isPersonProperty

import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
private boolean isPersonProperty(Object bo, String propertyName) {
    try {
    	if (PropertyAccessorUtils.isNestedOrIndexedProperty( propertyName ) // is a nested property
        		&& !StringUtils.contains(propertyName, "add.") ) {// exclude add line properties (due to path parsing problems in PropertyUtils.getPropertyType)
            int lastIndex = PropertyAccessorUtils.getLastNestedPropertySeparatorIndex(propertyName);
            String propertyTypeName = lastIndex != -1 ? StringUtils.substring(propertyName, 0, lastIndex) : StringUtils.EMPTY;
    		Class<?> type = PropertyUtils.getPropertyType(bo, propertyTypeName);
    		// property type indicates a Person object
    		if ( type != null ) {
    			return Person.class.isAssignableFrom(type);
    		}
    		LOG.warn( "Unable to determine type of nested property: " + bo.getClass().getName() + " / " + propertyName );
    	}
    } catch (Exception ex) {
    	if ( LOG.isDebugEnabled() ) {
    		LOG.debug("Unable to determine if property on " + bo.getClass().getName() + " to a person object: " + propertyName, ex );
    	}
    }
    return false;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:PersonServiceImpl.java

示例3: 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);
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:20,代码来源:PropertyPath.java

示例4: getNestedAttributePrefix

import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
/**
 * Returns the prefix of a nested attribute name, or the empty string if the attribute name is not nested.
 *
 * @param attributeName
 * @return everything BEFORE the last "." character in attributeName
 */
public static String getNestedAttributePrefix(String attributeName) {
    int lastIndex = PropertyAccessorUtils.getLastNestedPropertySeparatorIndex(attributeName);

    return lastIndex != -1 ? StringUtils.substring(attributeName, 0, lastIndex) : StringUtils.EMPTY;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:KRADUtils.java

示例5: getNestedAttributePrimitive

import org.springframework.beans.PropertyAccessorUtils; //导入方法依赖的package包/类
/**
 * Returns the primitive part of an attribute name string.
 *
 * @param attributeName
 * @return everything AFTER the last "." character in attributeName
 */
public static String getNestedAttributePrimitive(String attributeName) {
    int lastIndex = PropertyAccessorUtils.getLastNestedPropertySeparatorIndex(attributeName);

    return lastIndex != -1 ? StringUtils.substring(attributeName, lastIndex + 1) : attributeName;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:KRADUtils.java


注:本文中的org.springframework.beans.PropertyAccessorUtils.getLastNestedPropertySeparatorIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。