Java Code Examples for org.springframework.beans.factory.config.RuntimeBeanNameReference#setSource()

The following examples show how to use org.springframework.beans.factory.config.RuntimeBeanNameReference#setSource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BeanDefinitionParserDelegate.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Return a typed String value Object for the given 'idref' element.
 */
@Nullable
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)) {
		error("'bean' 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;
}
 
Example 2
Source File: BeanDefinitionParserDelegate.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Return a typed String value Object for the given 'idref' element.
 */
@Nullable
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)) {
		error("'bean' 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;
}
 
Example 3
Source File: BeanDefinitionParserDelegate.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: BeanDefinitionParserDelegate.java    From blog_demos with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: BeanDefinitionParserDelegate.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}