當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。