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


Java BeanWrapper.getPropertyType方法代码示例

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


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

示例1: resolveNestedPropertyName

import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
private String resolveNestedPropertyName(BeanWrapper target, String prefix,
		String name) {
	StringBuilder candidate = new StringBuilder();
	for (String field : name.split("[_\\-\\.]")) {
		candidate.append(candidate.length() > 0 ? "." : "");
		candidate.append(field);
		String nested = resolvePropertyName(target, prefix, candidate.toString());
		if (nested != null) {
			Class<?> type = target.getPropertyType(nested);
			if ((type != null) && Map.class.isAssignableFrom(type)) {
				// Special case for map property (gh-3836).
				return nested + "[" + name.substring(candidate.length() + 1) + "]";
			}
			String propertyName = resolvePropertyName(target,
					joinString(prefix, nested),
					name.substring(candidate.length() + 1));
			if (propertyName != null) {
				return joinString(nested, propertyName);
			}
		}
	}
	return null;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:24,代码来源:RelaxedDataBinder.java

示例2: resolvePropertyName

import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
private String resolvePropertyName(BeanWrapper target, String prefix, String name) {
	Iterable<String> names = getNameAndAliases(name);
	for (String nameOrAlias : names) {
		for (String candidate : new RelaxedNames(nameOrAlias)) {
			try {
				if (target.getPropertyType(joinString(prefix, candidate)) != null) {
					return candidate;
				}
			}
			catch (InvalidPropertyException ex) {
				// swallow and continue
			}
		}
	}
	return null;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:RelaxedDataBinder.java

示例3: testUseBlueprintExceptions

import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
public void testUseBlueprintExceptions() throws Exception {
	OsgiServiceProxyFactoryBean fb = new OsgiServiceProxyFactoryBean();
	BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(fb);
	String propertyName = "useBlueprintExceptions";
	for (PropertyDescriptor desc : wrapper.getPropertyDescriptors()) {
		System.out.println(desc.getName());
	}
	Class type = wrapper.getPropertyType(propertyName);
	System.out.println("type is " + type);
	assertTrue(wrapper.isWritableProperty(propertyName));
	assertFalse(wrapper.isReadableProperty(propertyName));
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:13,代码来源:BlueprintFieldsTest.java

示例4: getTypeDescriptor

import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
/**
 * Obtains the descriptor of the filtered field
 * 
 * @param fieldName
 * @param entityType
 * @return
 */
public static <T> TypeDescriptor getTypeDescriptor(String fieldName,
        Class<T> entityType) {
    String fieldNameToFindType = fieldName;
    BeanWrapper beanWrapper = getBeanWrapper(entityType);

    TypeDescriptor fieldDescriptor = null;
    Class<?> propType = null;
    // Find recursive the las beanWrapper
    if (fieldName.contains(SEPARATOR_FIELDS)) {
        String[] fieldNameSplitted = StringUtils.split(fieldName,
                SEPARATOR_FIELDS);
        for (int i = 0; i < fieldNameSplitted.length - 1; i++) {
            propType = beanWrapper.getPropertyType(fieldNameSplitted[i]);
            if (propType == null) {
                throw new IllegalArgumentException(String.format(
                        "Property %s not found in %s (request %s.%s)",
                        fieldNameSplitted[i],
                        beanWrapper.getWrappedClass(), entityType,
                        fieldName));
            }
            beanWrapper = getBeanWrapper(propType);
        }
        fieldNameToFindType = fieldNameSplitted[fieldNameSplitted.length - 1];
    }
    fieldDescriptor = beanWrapper
            .getPropertyTypeDescriptor(fieldNameToFindType);

    return fieldDescriptor;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:37,代码来源:QuerydslUtils.java

示例5: getTypeDescriptor

import org.springframework.beans.BeanWrapper; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public <T> TypeDescriptor getTypeDescriptor(String fieldName,
        Class<T> entityType) {
    String fieldNameToFindType = fieldName;
    BeanWrapper beanWrapper = getBeanWrapper(entityType);

    TypeDescriptor fieldDescriptor = null;
    Class<?> propType = null;
    // Find recursive the las beanWrapper
    if (fieldName.contains(SEPARATOR_FIELDS)) {
        String[] fieldNameSplitted = StringUtils.split(fieldName,
                SEPARATOR_FIELDS);
        for (int i = 0; i < fieldNameSplitted.length - 1; i++) {
            propType = beanWrapper.getPropertyType(fieldNameSplitted[i]);
            if (propType == null) {
                throw new IllegalArgumentException(String.format(
                        "Property %s not found in %s (request %s.%s)",
                        fieldNameSplitted[i],
                        beanWrapper.getWrappedClass(), entityType,
                        fieldName));
            }
            beanWrapper = getBeanWrapper(propType);
        }
        fieldNameToFindType = fieldNameSplitted[fieldNameSplitted.length - 1];
    }
    fieldDescriptor = beanWrapper
            .getPropertyTypeDescriptor(fieldNameToFindType);

    return fieldDescriptor;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:34,代码来源:QuerydslUtilsBeanImpl.java


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