本文整理汇总了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);
}
}
}