本文整理汇总了Java中org.springframework.beans.factory.config.RuntimeBeanNameReference.setSource方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeBeanNameReference.setSource方法的具体用法?Java RuntimeBeanNameReference.setSource怎么用?Java RuntimeBeanNameReference.setSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.factory.config.RuntimeBeanNameReference
的用法示例。
在下文中一共展示了RuntimeBeanNameReference.setSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseIdRefElement
import org.springframework.beans.factory.config.RuntimeBeanNameReference; //导入方法依赖的package包/类
/**
* Return a typed String value Object for the given 'idref' element.
*/
public Object parseIdRefElement(Element ele) {
// A generic reference to any name of any bean.
String refName = ele.getAttribute(BEAN_REF_ATTRIBUTE);
if (!StringUtils.hasLength(refName)) {
// A reference to the id of another bean in the same XML file.
refName = ele.getAttribute(LOCAL_REF_ATTRIBUTE);
if (!StringUtils.hasLength(refName)) {
error("Either 'bean' or 'local' is required for <idref> element", ele);
return null;
}
}
if (!StringUtils.hasText(refName)) {
error("<idref> element contains empty target attribute", ele);
return null;
}
RuntimeBeanNameReference ref = new RuntimeBeanNameReference(refName);
ref.setSource(extractSource(ele));
return ref;
}
示例2: parseIdRefElement
import org.springframework.beans.factory.config.RuntimeBeanNameReference; //导入方法依赖的package包/类
private Object parseIdRefElement(Element ele) {
// A generic reference to any name of any bean/component.
String refName = ele.getAttribute(COMPONENT_ID_ATTR);
if (!StringUtils.hasLength(refName)) {
error("'" + COMPONENT_ID_ATTR + "' is required for <idref> element", ele);
return null;
}
if (!StringUtils.hasText(refName)) {
error("<idref> element contains empty target attribute", ele);
return null;
}
RuntimeBeanNameReference ref = new RuntimeBeanNameReference(refName);
ref.setSource(parserContext.extractSource(ele));
return ref;
}