本文整理匯總了Java中org.springframework.beans.PropertyValue.setSource方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyValue.setSource方法的具體用法?Java PropertyValue.setSource怎麽用?Java PropertyValue.setSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.beans.PropertyValue
的用法示例。
在下文中一共展示了PropertyValue.setSource方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parsePropertyElement
import org.springframework.beans.PropertyValue; //導入方法依賴的package包/類
private void parsePropertyElement(Element ele, BeanDefinition bd) {
String propertyName = ele.getAttribute(BeanDefinitionParserDelegate.NAME_ATTRIBUTE);
if (!StringUtils.hasLength(propertyName)) {
error("Tag 'property' must have a 'name' attribute", ele);
return;
}
this.parseState.push(new PropertyEntry(propertyName));
try {
if (bd.getPropertyValues().contains(propertyName)) {
error("Multiple 'property' definitions for property '" + propertyName + "'", ele);
return;
}
Object val = parsePropertyValue(ele, bd, propertyName);
PropertyValue pv = new PropertyValue(propertyName, val);
pv.setSource(parserContext.extractSource(ele));
bd.getPropertyValues().addPropertyValue(pv);
} finally {
this.parseState.pop();
}
}
示例2: parsePropertyElement
import org.springframework.beans.PropertyValue; //導入方法依賴的package包/類
/**
* Parse a property element.
*/
public void parsePropertyElement(Element ele, BeanDefinition bd) {
String propertyName = ele.getAttribute(NAME_ATTRIBUTE);
if (!StringUtils.hasLength(propertyName)) {
error("Tag 'property' must have a 'name' attribute", ele);
return;
}
this.parseState.push(new PropertyEntry(propertyName));
try {
if (bd.getPropertyValues().contains(propertyName)) {
error("Multiple 'property' definitions for property '" + propertyName + "'", ele);
return;
}
Object val = parsePropertyValue(ele, bd, propertyName);
PropertyValue pv = new PropertyValue(propertyName, val);
parseMetaElements(ele, pv);
pv.setSource(extractSource(ele));
bd.getPropertyValues().addPropertyValue(pv);
}
finally {
this.parseState.pop();
}
}
示例3: doParse
import org.springframework.beans.PropertyValue; //導入方法依賴的package包/類
@Override
protected void doParse(Element element, ParserContext pc,
BeanDefinitionBuilder bean) {
if(element.getLocalName().toLowerCase().contains("text")) {
element.setAttribute(ID_ATTRIBUTE, KaWebSocketBean.TEXT_PROTOCOLS_CONFIG_ID);
} else {
element.setAttribute(ID_ATTRIBUTE, KaWebSocketBean.BINARY_PROTOCOLS_CONFIG_ID);
}
bean.setLazyInit(false);
String ref = element.getAttribute("defaultProtocolRef");
if(ref != null && !ref.isEmpty()) {
bean.addPropertyReference("defaultProtocol", ref);
}
ManagedMap<String, RuntimeBeanReference> protocols = getProtocols(element);
if(!protocols.isEmpty()) {
MutablePropertyValues props = bean.getBeanDefinition().getPropertyValues();
PropertyValue value = props.getPropertyValue("protocolHandlers");
if (value == null) {
props.addPropertyValue("protocolHandlers", protocols);
} else {
value.setSource(protocols);
}
}
}