当前位置: 首页>>代码示例>>Java>>正文


Java BeanMetadataAttribute类代码示例

本文整理汇总了Java中org.springframework.beans.BeanMetadataAttribute的典型用法代码示例。如果您正苦于以下问题:Java BeanMetadataAttribute类的具体用法?Java BeanMetadataAttribute怎么用?Java BeanMetadataAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BeanMetadataAttribute类属于org.springframework.beans包,在下文中一共展示了BeanMetadataAttribute类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerBeans

import org.springframework.beans.BeanMetadataAttribute; //导入依赖的package包/类
@Override
protected void registerBeans(InjectLock annotation, ResolvableType targetType, BeanDefinitionRegistry registry) {
    String name = LockBean.class.getName() + "-" + annotation.name() + "--" + annotation.name();

    if (!registry.containsBeanDefinition(name)) {
        AbstractBeanDefinition def = BeanDefinitionBuilder.rootBeanDefinition(LockBean.class)
            .setLazyInit(true)
            .addPropertyValue("region", annotation.region())
            .addPropertyValue("name", annotation.name())
            .getBeanDefinition();

        AutowireCandidateQualifier qualifier = new AutowireCandidateQualifier(annotation.annotationType());
        qualifier.addMetadataAttribute(new BeanMetadataAttribute("region", annotation.region()));
        qualifier.addMetadataAttribute(new BeanMetadataAttribute("name", annotation.name()));

        def.addQualifier(qualifier);

        registry.registerBeanDefinition(name, def);
    }
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:21,代码来源:HekateLockServiceConfigurer.java

示例2: parseMetaElements

import org.springframework.beans.BeanMetadataAttribute; //导入依赖的package包/类
public void parseMetaElements(Element ele, BeanMetadataAttributeAccessor attributeAccessor) {
	NodeList nl = ele.getChildNodes();
	for (int i = 0; i < nl.getLength(); i++) {
		Node node = nl.item(i);
		if (isCandidateElement(node) && nodeNameEquals(node, META_ELEMENT)) {
			Element metaElement = (Element) node;
			String key = metaElement.getAttribute(KEY_ATTRIBUTE);
			String value = metaElement.getAttribute(VALUE_ATTRIBUTE);
			BeanMetadataAttribute attribute = new BeanMetadataAttribute(key, value);
			attribute.setSource(extractSource(metaElement));
			attributeAccessor.addMetadataAttribute(attribute);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:BeanDefinitionParserDelegate.java

示例3: parseQualifierElement

import org.springframework.beans.BeanMetadataAttribute; //导入依赖的package包/类
/**
 * Parse a qualifier element.
 */
public void parseQualifierElement(Element ele, AbstractBeanDefinition bd) {
	String typeName = ele.getAttribute(TYPE_ATTRIBUTE);
	if (!StringUtils.hasLength(typeName)) {
		error("Tag 'qualifier' must have a 'type' attribute", ele);
		return;
	}
	this.parseState.push(new QualifierEntry(typeName));
	try {
		AutowireCandidateQualifier qualifier = new AutowireCandidateQualifier(typeName);
		qualifier.setSource(extractSource(ele));
		String value = ele.getAttribute(VALUE_ATTRIBUTE);
		if (StringUtils.hasLength(value)) {
			qualifier.setAttribute(AutowireCandidateQualifier.VALUE_KEY, value);
		}
		NodeList nl = ele.getChildNodes();
		for (int i = 0; i < nl.getLength(); i++) {
			Node node = nl.item(i);
			if (isCandidateElement(node) && nodeNameEquals(node, QUALIFIER_ATTRIBUTE_ELEMENT)) {
				Element attributeEle = (Element) node;
				String attributeName = attributeEle.getAttribute(KEY_ATTRIBUTE);
				String attributeValue = attributeEle.getAttribute(VALUE_ATTRIBUTE);
				if (StringUtils.hasLength(attributeName) && StringUtils.hasLength(attributeValue)) {
					BeanMetadataAttribute attribute = new BeanMetadataAttribute(attributeName, attributeValue);
					attribute.setSource(extractSource(attributeEle));
					qualifier.addMetadataAttribute(attribute);
				}
				else {
					error("Qualifier 'attribute' tag must have a 'name' and 'value'", attributeEle);
					return;
				}
			}
		}
		bd.addQualifier(qualifier);
	}
	finally {
		this.parseState.pop();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:42,代码来源:BeanDefinitionParserDelegate.java


注:本文中的org.springframework.beans.BeanMetadataAttribute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。