本文整理匯總了Java中org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder方法的典型用法代碼示例。如果您正苦於以下問題:Java ConstructorArgumentValues.ValueHolder方法的具體用法?Java ConstructorArgumentValues.ValueHolder怎麽用?Java ConstructorArgumentValues.ValueHolder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.beans.factory.config.ConstructorArgumentValues
的用法示例。
在下文中一共展示了ConstructorArgumentValues.ValueHolder方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addConstructorArgs
import org.springframework.beans.factory.config.ConstructorArgumentValues; //導入方法依賴的package包/類
public void addConstructorArgs(Object value, Class type, BeanDefinition bd) {
ConstructorArgumentValues.ValueHolder vHolder
= new ConstructorArgumentValues.ValueHolder(value, type.getName());
ConstructorArgumentValues args
= bd.getConstructorArgumentValues();
args.addIndexedArgumentValue(args.getArgumentCount(), vHolder);
}
示例2: updateEntityScanBeanPostProcessor
import org.springframework.beans.factory.config.ConstructorArgumentValues; //導入方法依賴的package包/類
private void updateEntityScanBeanPostProcessor(BeanDefinitionRegistry registry,
Set<String> packagesToScan) {
BeanDefinition definition = registry
.getBeanDefinition(this.beanPostProcessorName);
ConstructorArgumentValues.ValueHolder constructorArguments = definition
.getConstructorArgumentValues().getGenericArgumentValue(String[].class);
Set<String> mergedPackages = new LinkedHashSet<String>();
mergedPackages.addAll(Arrays.asList((String[]) constructorArguments.getValue()));
mergedPackages.addAll(packagesToScan);
constructorArguments.setValue(toArray(mergedPackages));
}
示例3: parseConstructorArgElement
import org.springframework.beans.factory.config.ConstructorArgumentValues; //導入方法依賴的package包/類
private void parseConstructorArgElement(Element ele, AbstractBeanDefinition beanDefinition) {
String indexAttr = ele.getAttribute(BeanDefinitionParserDelegate.INDEX_ATTRIBUTE);
String typeAttr = ele.getAttribute(BeanDefinitionParserDelegate.TYPE_ATTRIBUTE);
boolean hasIndex = false;
int index = -1;
if (StringUtils.hasLength(indexAttr)) {
hasIndex = true;
try {
index = Integer.parseInt(indexAttr);
} catch (NumberFormatException ex) {
error("Attribute 'index' of tag 'constructor-arg' must be an integer", ele);
}
if (index < 0) {
error("'index' cannot be lower than 0", ele);
}
}
try {
this.parseState.push(hasIndex ? new ConstructorArgumentEntry(index) : new ConstructorArgumentEntry());
ConstructorArgumentValues values = beanDefinition.getConstructorArgumentValues();
// Blueprint failure (index duplication)
Integer indexInt = Integer.valueOf(index);
if (values.getIndexedArgumentValues().containsKey(indexInt)) {
error("duplicate 'index' with value=[" + index + "] specified", ele);
}
Object value = parsePropertyValue(ele, beanDefinition, null);
ConstructorArgumentValues.ValueHolder valueHolder = new ConstructorArgumentValues.ValueHolder(value);
if (StringUtils.hasLength(typeAttr)) {
valueHolder.setType(typeAttr);
}
valueHolder.setSource(extractSource(ele));
if (hasIndex) {
values.addIndexedArgumentValue(index, valueHolder);
} else {
values.addGenericArgumentValue(valueHolder);
}
// Blueprint failure (mixed index/non-indexed arguments)
if (!values.getGenericArgumentValues().isEmpty() && !values.getIndexedArgumentValues().isEmpty()) {
error("indexed and non-indexed constructor arguments are not supported by Blueprint; "
+ "consider using the Spring namespace instead", ele);
}
} finally {
this.parseState.pop();
}
}