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


Java BeanDefinition.getPropertyValues方法代码示例

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


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

示例1: findInnerBeanDefinitionsAndBeanReferences

import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
private void findInnerBeanDefinitionsAndBeanReferences(BeanDefinition beanDefinition) {
	List<BeanDefinition> innerBeans = new ArrayList<BeanDefinition>();
	List<BeanReference> references = new ArrayList<BeanReference>();
	PropertyValues propertyValues = beanDefinition.getPropertyValues();
	for (int i = 0; i < propertyValues.getPropertyValues().length; i++) {
		PropertyValue propertyValue = propertyValues.getPropertyValues()[i];
		Object value = propertyValue.getValue();
		if (value instanceof BeanDefinitionHolder) {
			innerBeans.add(((BeanDefinitionHolder) value).getBeanDefinition());
		}
		else if (value instanceof BeanDefinition) {
			innerBeans.add((BeanDefinition) value);
		}
		else if (value instanceof BeanReference) {
			references.add((BeanReference) value);
		}
	}
	this.innerBeanDefinitions = innerBeans.toArray(new BeanDefinition[innerBeans.size()]);
	this.beanReferences = references.toArray(new BeanReference[references.size()]);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:BeanComponentDefinition.java

示例2: unwrapDefinitions

import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
private void unwrapDefinitions(BeanDefinition advisorDefinition, BeanDefinition pointcutDefinition) {
	MutablePropertyValues pvs = advisorDefinition.getPropertyValues();
	BeanReference adviceReference = (BeanReference) pvs.getPropertyValue("adviceBeanName").getValue();

	if (pointcutDefinition != null) {
		this.beanReferences = new BeanReference[] {adviceReference};
		this.beanDefinitions = new BeanDefinition[] {advisorDefinition, pointcutDefinition};
		this.description = buildDescription(adviceReference, pointcutDefinition);
	}
	else {
		BeanReference pointcutReference = (BeanReference) pvs.getPropertyValue("pointcut").getValue();
		this.beanReferences = new BeanReference[] {adviceReference, pointcutReference};
		this.beanDefinitions = new BeanDefinition[] {advisorDefinition};
		this.description = buildDescription(adviceReference, pointcutReference);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:AdvisorComponentDefinition.java

示例3: postProcessBeanFactory

import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void postProcessBeanFactory(
    ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
    String[] igniteConfigNames = configurableListableBeanFactory.getBeanNamesForType(IgniteConfiguration.class);
    if (igniteConfigNames.length != 1) {
        throw new IllegalArgumentException("Spring config must contain exactly one ignite configuration!");
    }
    String[] activeStoreConfigNames = configurableListableBeanFactory.getBeanNamesForType(BaseActiveStoreConfiguration.class);
    if (activeStoreConfigNames.length != 1) {
        throw new IllegalArgumentException("Spring config must contain exactly one active store configuration!");
    }
    BeanDefinition igniteConfigDef = configurableListableBeanFactory.getBeanDefinition(igniteConfigNames[0]);
    MutablePropertyValues propertyValues = igniteConfigDef.getPropertyValues();
    if (!propertyValues.contains(USER_ATTRS_PROP_NAME)) {
        propertyValues.add(USER_ATTRS_PROP_NAME, new ManagedMap());
    }
    PropertyValue propertyValue = propertyValues.getPropertyValue(USER_ATTRS_PROP_NAME);
    Map userAttrs = (Map)propertyValue.getValue();
    TypedStringValue key = new TypedStringValue(CONFIG_USER_ATTR);
    RuntimeBeanReference value = new RuntimeBeanReference(beanName);
    userAttrs.put(key, value);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:24,代码来源:BaseActiveStoreConfiguration.java

示例4: postProcessBeanFactory

import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
/**
 * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)
 */
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
{
    ParameterCheck.mandatory("beanName", beanName);
    ParameterCheck.mandatory("extendingBeanName", extendingBeanName);

    // check for bean name
    if (!beanFactory.containsBean(beanName))
    {
        throw new NoSuchBeanDefinitionException("Can't find bean '" + beanName + "' to be extended.");
    }

    // check for extending bean
    if (!beanFactory.containsBean(extendingBeanName))
    {
        throw new NoSuchBeanDefinitionException("Can't find bean '" + extendingBeanName + "' that is going to extend original bean definition.");
    }

    // get the bean definitions
    BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);
    BeanDefinition extendingBeanDefinition = beanFactory.getBeanDefinition(extendingBeanName);

    // update class
    if (StringUtils.isNotBlank(extendingBeanDefinition.getBeanClassName()) &&
        !beanDefinition.getBeanClassName().equals(extendingBeanDefinition.getBeanClassName()))
    {
        beanDefinition.setBeanClassName(extendingBeanDefinition.getBeanClassName());
    }

    // update properties
    MutablePropertyValues properties = beanDefinition.getPropertyValues();
    MutablePropertyValues extendingProperties = extendingBeanDefinition.getPropertyValues();
    for (PropertyValue propertyValue : extendingProperties.getPropertyValueList())
    {
        properties.add(propertyValue.getName(), propertyValue.getValue());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:41,代码来源:BeanExtender.java

示例5: SimpleServiceExportComponentMetadata

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

	MutablePropertyValues pvs = definition.getPropertyValues();

	DefaultInterfaceDetector autoExp = (DefaultInterfaceDetector) MetadataUtils.getValue(pvs, AUTO_EXPORT_PROP);
	// convert the internal numbers
	autoExport = autoExp.ordinal() + 1;

	// ranking
	if (pvs.contains(RANKING_PROP)) {
		String rank = (String) MetadataUtils.getValue(pvs, RANKING_PROP);
		ranking = Integer.valueOf(rank).intValue();
	} else {
		ranking = 0;
	}

	// component
	if (pvs.contains(SERVICE_NAME_PROP)) {
		String compName = (String) MetadataUtils.getValue(pvs, SERVICE_NAME_PROP);
		component = new SimpleRefMetadata(compName);
	} else {
		component = (Target) ValueFactory.buildValue(MetadataUtils.getValue(pvs, SERVICE_INSTANCE_PROP));
	}

	// interfaces
	Object value = MetadataUtils.getValue(pvs, INTERFACES_PROP);

	if (value != null) {
		List<String> intfs = new ArrayList<String>(4);
		// interface attribute used
		if (value instanceof String) {
			intfs.add((String) value);
		}

		else {
			if (value instanceof Collection) {
				Collection<TypedStringValue> values = (Collection) value;

				for (TypedStringValue tsv : values) {
					intfs.add(tsv.getValue());
				}
			}
		}
		interfaces = Collections.unmodifiableList(intfs);
	} else {
		interfaces = Collections.emptyList();
	}

	// service properties
	if (pvs.contains(SERVICE_PROPERTIES_PROP)) {
		Map props = (Map) MetadataUtils.getValue(pvs, SERVICE_PROPERTIES_PROP);
		serviceProperties = ValueFactory.getEntries(props);
	} else {
		serviceProperties = Collections.emptyList();
	}

	// listeners
	List<RegistrationListener> foundListeners = new ArrayList<RegistrationListener>(4);
	List<? extends AbstractBeanDefinition> listenerDefinitions = (List) MetadataUtils.getValue(pvs, LISTENERS_PROP);

	if (listenerDefinitions != null) {
		for (AbstractBeanDefinition beanDef : listenerDefinitions) {
			foundListeners.add(new SimpleRegistrationListener(beanDef));
		}
	}

	listeners = Collections.unmodifiableCollection(foundListeners);

	Boolean bool = (Boolean) MetadataUtils.getValue(pvs, LAZY_LISTENERS);
	activation =
			(bool != null ? (bool.booleanValue() ? ACTIVATION_LAZY : ACTIVATION_EAGER) : super.getActivation());

}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:82,代码来源:SimpleServiceExportComponentMetadata.java


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