當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。