當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyValues.getPropertyValues方法代碼示例

本文整理匯總了Java中org.springframework.beans.PropertyValues.getPropertyValues方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyValues.getPropertyValues方法的具體用法?Java PropertyValues.getPropertyValues怎麽用?Java PropertyValues.getPropertyValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.beans.PropertyValues的用法示例。


在下文中一共展示了PropertyValues.getPropertyValues方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findInnerBeanDefinitionsAndBeanReferences

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
private void findInnerBeanDefinitionsAndBeanReferences(BeanDefinition beanDefinition) {
	List<BeanDefinition> innerBeans = new ArrayList<BeanDefinition>();
	List<BeanReference> references = new ArrayList<BeanReference>();
	PropertyValues propertyValues = beanDefinition.getPropertyValues();
	for (int i = 0; i < propertyValues.getPropertyValues().length; i++) {
		PropertyValue propertyValue = propertyValues.getPropertyValues()[i];
		Object value = propertyValue.getValue();
		if (value instanceof BeanDefinitionHolder) {
			innerBeans.add(((BeanDefinitionHolder) value).getBeanDefinition());
		}
		else if (value instanceof BeanDefinition) {
			innerBeans.add((BeanDefinition) value);
		}
		else if (value instanceof BeanReference) {
			references.add((BeanReference) value);
		}
	}
	this.innerBeanDefinitions = innerBeans.toArray(new BeanDefinition[innerBeans.size()]);
	this.beanReferences = references.toArray(new BeanReference[references.size()]);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:21,代碼來源:BeanComponentDefinition.java

示例2: doTestTony

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
 * Must contain: forname=Tony surname=Blair age=50
 */
protected void doTestTony(PropertyValues pvs) throws Exception {
	assertTrue("Contains 3", pvs.getPropertyValues().length == 3);
	assertTrue("Contains forname", pvs.contains("forname"));
	assertTrue("Contains surname", pvs.contains("surname"));
	assertTrue("Contains age", pvs.contains("age"));
	assertTrue("Doesn't contain tory", !pvs.contains("tory"));

	PropertyValue[] pvArray = pvs.getPropertyValues();
	Map<String, String> m = new HashMap<String, String>();
	m.put("forname", "Tony");
	m.put("surname", "Blair");
	m.put("age", "50");
	for (PropertyValue pv : pvArray) {
		Object val = m.get(pv.getName());
		assertTrue("Can't have unexpected value", val != null);
		assertTrue("Val i string", val instanceof String);
		assertTrue("val matches expected", val.equals(pv.getValue()));
		m.remove(pv.getName());
	}
	assertTrue("Map size is 0", m.size() == 0);
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:25,代碼來源:WebRequestDataBinderTests.java

示例3: doTestTony

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
/**
 * Must contain: forname=Tony surname=Blair age=50
 */
protected void doTestTony(PropertyValues pvs) throws Exception {
	assertTrue("Contains 3", pvs.getPropertyValues().length == 3);
	assertTrue("Contains forname", pvs.contains("forname"));
	assertTrue("Contains surname", pvs.contains("surname"));
	assertTrue("Contains age", pvs.contains("age"));
	assertTrue("Doesn't contain tory", !pvs.contains("tory"));

	PropertyValue[] ps = pvs.getPropertyValues();
	Map<String, String> m = new HashMap<String, String>();
	m.put("forname", "Tony");
	m.put("surname", "Blair");
	m.put("age", "50");
	for (int i = 0; i < ps.length; i++) {
		Object val = m.get(ps[i].getName());
		assertTrue("Can't have unexpected value", val != null);
		assertTrue("Val i string", val instanceof String);
		assertTrue("val matches expected", val.equals(ps[i].getValue()));
		m.remove(ps[i].getName());
	}
	assertTrue("Map size is 0", m.size() == 0);
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:25,代碼來源:ServletRequestDataBinderTests.java

示例4: filterPropertyValues

import org.springframework.beans.PropertyValues; //導入方法依賴的package包/類
private PropertyValues filterPropertyValues(PropertyValues propertyValues, String prefix) {
	if (prefix == null || prefix.length() == 0)
		return propertyValues;

	PropertyValue[] valueArray = propertyValues.getPropertyValues();
	MutablePropertyValues newValues = new MutablePropertyValues();
	for (PropertyValue propertyValue : valueArray) {
		String name = propertyValue.getName();
		final String prefixWithDot = prefix + PREFIX_SEPERATOR;
		if (name.startsWith(prefixWithDot)) {
			name = name.substring(prefixWithDot.length(), name.length());
			newValues.addPropertyValue(name, propertyValue.getValue());
		}
	}
	return newValues;
}
 
開發者ID:curtiszimmerman,項目名稱:AlgoTrader,代碼行數:17,代碼來源:GrailsDataBinder.java


注:本文中的org.springframework.beans.PropertyValues.getPropertyValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。