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


Java BeanDefinition.hasAttribute方法代码示例

本文整理汇总了Java中org.springframework.beans.factory.config.BeanDefinition.hasAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java BeanDefinition.hasAttribute方法的具体用法?Java BeanDefinition.hasAttribute怎么用?Java BeanDefinition.hasAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.factory.config.BeanDefinition的用法示例。


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

示例1: buildComponentMetadataFor

import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
public static List<ComponentMetadata> buildComponentMetadataFor(ConfigurableListableBeanFactory factory) {
	List<ComponentMetadata> metadata = new ArrayList<ComponentMetadata>();
	String[] components = factory.getBeanDefinitionNames();

	for (String beanName : components) {
		BeanDefinition definition = factory.getBeanDefinition(beanName);

		// filter generated definitions
		if (!definition.hasAttribute(PROMOTED_REF)) {
			// add metadata for top-level definitions
			metadata.add(MetadataFactory.buildComponentMetadataFor(beanName, definition));
			// look for nested ones
			metadata.addAll(MetadataFactory.buildNestedComponentMetadataFor(definition));
		}
	}

	return metadata;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:19,代码来源:ComponentMetadataFactory.java

示例2: SimpleBeanMetadata

import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
/**
 * Constructs a new <code>SpringLocalComponentMetadata</code> instance.
 * 
 * @param name bean name
 * @param definition Spring bean definition
 */
public SimpleBeanMetadata(String name, BeanDefinition definition) {
	super(name, definition);

	final String factoryMtd = definition.getFactoryMethodName();
	if (StringUtils.hasText(factoryMtd)) {
		factoryMethod = factoryMtd;
		String factory = definition.getFactoryBeanName();
		if (StringUtils.hasText(factory)) {
			factoryComponent = new SimpleRefMetadata(factory);
		} else {
			factoryComponent = null;
		}
	} else {
		factoryComponent = null;
		factoryMethod = null;
	}

	arguments = MetadataUtils.getBeanArguments(definition);
	properties = MetadataUtils.getBeanProperties(definition);

	// double check if the definition had "scope" declared
	boolean hasAttribute = definition.hasAttribute(BlueprintParser.DECLARED_SCOPE);
	scope = (hasAttribute ? (StringUtils.hasText(name) ? beanDefinition.getScope() : null) : null);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:31,代码来源:SimpleBeanMetadata.java

示例3: postProcessBeanFactory

import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

		boolean trace = log.isTraceEnabled();

		String[] names = beanFactory.getBeanDefinitionNames();
		for (String name : names) {
			BeanDefinition definition = beanFactory.getBeanDefinition(name);
			if (definition.hasAttribute(ParsingUtils.BLUEPRINT_MARKER_NAME)) {
				ConstructorArgumentValues cArgs = definition.getConstructorArgumentValues();
				if (trace)
					log.trace("Inspecting cycles for (blueprint) bean " + name);

				tag(cArgs.getGenericArgumentValues(), name, definition);
				tag(cArgs.getIndexedArgumentValues().values(), name, definition);
			}
		}
	}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:18,代码来源:CycleOrderingProcessor.java

示例4: getConfigurationClassFactoryBeanGeneric

import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
private Class<?> getConfigurationClassFactoryBeanGeneric(ConfigurableListableBeanFactory beanFactory,
                                                         BeanDefinition definition, String name) throws Exception {
    Method method = getFactoryMethod(beanFactory, definition);
    Class<?> generic = ResolvableType.forMethodReturnType(method).as(FactoryBean.class).resolveGeneric();
    if ((generic == null || generic.equals(Object.class))
            && definition.hasAttribute(FACTORY_BEAN_OBJECT_TYPE)) {
        generic = getTypeFromAttribute(definition.getAttribute(FACTORY_BEAN_OBJECT_TYPE));
    }
    return generic;
}
 
开发者ID:drtrang,项目名称:spring-boot-autoconfigure,代码行数:11,代码来源:BeanTypeRegistry.java

示例5: getDirectFactoryBeanGeneric

import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
private Class<?> getDirectFactoryBeanGeneric(
        ConfigurableListableBeanFactory beanFactory, BeanDefinition definition,
        String name) throws ClassNotFoundException, LinkageError {
    Class<?> factoryBeanClass = ClassUtils.forName(definition.getBeanClassName(), beanFactory.getBeanClassLoader());
    Class<?> generic = ResolvableType.forClass(factoryBeanClass).as(FactoryBean.class).resolveGeneric();
    if ((generic == null || generic.equals(Object.class))
            && definition.hasAttribute(FACTORY_BEAN_OBJECT_TYPE)) {
        generic = getTypeFromAttribute(definition.getAttribute(FACTORY_BEAN_OBJECT_TYPE));
    }
    return generic;
}
 
开发者ID:drtrang,项目名称:spring-boot-autoconfigure,代码行数:12,代码来源:BeanTypeRegistry.java


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