List of usage examples for org.springframework.beans.factory.config ConstructorArgumentValues hasIndexedArgumentValue
public boolean hasIndexedArgumentValue(int index)
From source file:org.constretto.spring.ConfigurationAnnotationConfigurer.java
@Override public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException { for (String beanName : beanFactory.getBeanDefinitionNames()) { final BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName); final Class<?> beanType = beanFactory.getType(beanName); if (!configurableConstructorCache.containsKey(beanType)) { configurableConstructorCache.put(beanType, resolveConfigurableConstructor(beanType)); }// w w w . jav a 2s .c o m final Constructor<?> resolvedConstructor = configurableConstructorCache.get(beanType); if (resolvedConstructor != null) { final ConstructorArgumentValues constructorArgumentValues = beanDefinition .getConstructorArgumentValues(); final ArgumentDescription[] argumentDescriptions = ArgumentDescriptionFactory .create(resolvedConstructor).resolveParameters(); for (int i = 0; i < argumentDescriptions.length; i++) { ArgumentDescription argumentDescription = argumentDescriptions[i]; if (!constructorArgumentValues.hasIndexedArgumentValue(i)) { final String keyName = argumentDescription.constrettoConfigurationKeyCandidate(); if (configuration.hasValue(keyName)) { constructorArgumentValues.addIndexedArgumentValue(i, configuration.evaluateTo(argumentDescription.getType(), keyName)); } } } } } }