Example usage for org.springframework.beans.factory.config BeanDefinition hasAttribute

List of usage examples for org.springframework.beans.factory.config BeanDefinition hasAttribute

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config BeanDefinition hasAttribute.

Prototype

boolean hasAttribute(String name);

Source Link

Document

Return true if the attribute identified by name exists.

Usage

From source file:com.griddynamics.banshun.ContextAnalyzer.java

protected BeanReferenceInfo extractImportReference(BeanDefinition beanDefinition) {
    if (!beanDefinition.hasAttribute(IMPORT_BEAN_DEF_ATTR_NAME)) {
        throw new IllegalArgumentException(
                "BeanDefinition does not contain attribute: " + IMPORT_BEAN_DEF_ATTR_NAME);
    }// w  w w  . ja  v a 2  s  .  c  o  m
    return (BeanReferenceInfo) beanDefinition.getAttribute(IMPORT_BEAN_DEF_ATTR_NAME);
}

From source file:com.griddynamics.banshun.ContextAnalyzer.java

protected BeanReferenceInfo extractExportReference(BeanDefinition beanDefinition) {
    if (!beanDefinition.hasAttribute(EXPORT_BEAN_DEF_ATTR_NAME)) {
        throw new IllegalArgumentException(
                "BeanDefinition does not contain attribute: " + EXPORT_BEAN_DEF_ATTR_NAME);
    }/*from  www. jav a 2 s  . c  om*/
    return (BeanReferenceInfo) beanDefinition.getAttribute(EXPORT_BEAN_DEF_ATTR_NAME);
}

From source file:com.griddynamics.banshun.StrictContextParentBean.java

/**
 * Check whether bean will be imported into other contexts.
 *
 * @param beanDefinition Definition of the bean to check.
 * @return <tt>true</tt> if the bean will be imported, <tt>false</tt> otherwise.
 */// w w w.  j av  a2 s.  c om
private boolean isImport(BeanDefinition beanDefinition) {
    return beanDefinition.hasAttribute(ParserUtils.IMPORT_BEAN_DEF_ATTR_NAME);
}

From source file:com.griddynamics.banshun.StrictContextParentBean.java

/**
 * Check whether bean will be exported from this context into others.
 *
 * @param beanDefinition Definition of the bean to check.
 * @return <tt>true</tt> if the bean will be exported, <tt>false</tt> otherwise.
 *//*from  w ww . jav  a  2  s . com*/
private boolean isExport(BeanDefinition beanDefinition) {
    return beanDefinition.hasAttribute(ParserUtils.EXPORT_BEAN_DEF_ATTR_NAME);
}

From source file:lodsve.core.condition.BeanTypeRegistry.java

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));
    }/*from ww w  .  j av a 2  s  .c o m*/
    return generic;
}

From source file:lodsve.core.condition.BeanTypeRegistry.java

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));
    }// www.j  a  v  a 2 s  .  c om
    return generic;
}

From source file:org.eclipse.gemini.blueprint.blueprint.container.support.internal.config.CycleOrderingProcessor.java

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);
        }//w  ww. j  av a2 s  . c o m
    }
}

From source file:org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.java

public static boolean testFlag(BeanDefinition bean, String flag) {
    return null != bean && bean.hasAttribute(flag) && bean.getAttribute(flag) instanceof Boolean
            && ((Boolean) bean.getAttribute(flag)).booleanValue();
}