本文整理匯總了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()]);
}
示例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);
}
}
示例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);
}
示例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());
}
}
示例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());
}