use of org.springframework.beans.factory.support.ManagedList in project cxf by apache.
the class UndertowHTTPServerEngineFactoryBeanDefinitionParser method getRequiredElementsList.
private List<Object> getRequiredElementsList(Element parent, ParserContext ctx, QName name, BeanDefinitionBuilder bean) {
List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(parent, name.getNamespaceURI(), name.getLocalPart());
ManagedList<Object> list = new ManagedList<Object>(elemList.size());
list.setSource(ctx.extractSource(parent));
for (Element elem : elemList) {
list.add(ctx.getDelegate().parsePropertySubElement(elem, bean.getBeanDefinition()));
}
return list;
}
use of org.springframework.beans.factory.support.ManagedList in project dubbo by alibaba.
the class ServiceAnnotationBeanPostProcessor method toRuntimeBeanReferences.
private ManagedList<RuntimeBeanReference> toRuntimeBeanReferences(String... beanNames) {
ManagedList<RuntimeBeanReference> runtimeBeanReferences = new ManagedList<RuntimeBeanReference>();
if (!ObjectUtils.isEmpty(beanNames)) {
for (String beanName : beanNames) {
String resolvedBeanName = environment.resolvePlaceholders(beanName);
runtimeBeanReferences.add(new RuntimeBeanReference(resolvedBeanName));
}
}
return runtimeBeanReferences;
}
use of org.springframework.beans.factory.support.ManagedList in project hudson-2.x by hudson.
the class BeanBuilder method manageListIfNecessary.
/**
* Checks whether there are any runtime refs inside the list and
* converts it to a ManagedList if necessary
*
* @param value The object that represents the list
* @return Either a new list or a managed one
*/
private Object manageListIfNecessary(Object value) {
List list = (List) value;
boolean containsRuntimeRefs = false;
for (ListIterator i = list.listIterator(); i.hasNext(); ) {
Object e = i.next();
if (e instanceof RuntimeBeanReference) {
containsRuntimeRefs = true;
}
if (e instanceof BeanConfiguration) {
BeanConfiguration c = (BeanConfiguration) e;
i.set(c.getBeanDefinition());
containsRuntimeRefs = true;
}
}
if (containsRuntimeRefs) {
List tmp = new ManagedList();
tmp.addAll((List) value);
value = tmp;
}
return value;
}
use of org.springframework.beans.factory.support.ManagedList in project grails-core by grails.
the class ChainedTransactionManagerPostProcessor method createTransactionManagerBeanReferences.
protected ManagedList<RuntimeBeanReference> createTransactionManagerBeanReferences(BeanDefinition chainedTransactionManagerBeanDefinition) {
ManagedList<RuntimeBeanReference> transactionManagerRefs = new ManagedList<RuntimeBeanReference>();
ConstructorArgumentValues constructorValues = chainedTransactionManagerBeanDefinition.getConstructorArgumentValues();
constructorValues.addIndexedArgumentValue(0, transactionManagerRefs);
transactionManagerRefs.add(new RuntimeBeanReference(PRIMARY_TRANSACTION_MANAGER));
return transactionManagerRefs;
}
use of org.springframework.beans.factory.support.ManagedList in project redisson by redisson.
the class RedissonRPCServerDefinitionParser method parseNested.
@Override
protected void parseNested(Element element, ParserContext parserContext, BeanDefinitionBuilder builder, BeanDefinition bd) {
Class<?> apiClass;
try {
apiClass = Class.forName(helper.getAttribute(element, RedissonNamespaceParserSupport.API_CLASS_ATTRIBUTE));
} catch (ClassNotFoundException ex) {
throw new IllegalArgumentException("The class [" + helper.getAttribute(element, RedissonNamespaceParserSupport.API_CLASS_ATTRIBUTE) + "] specified in \"" + RedissonNamespaceParserSupport.API_CLASS_ATTRIBUTE + "\" attribute has not " + "found. Please check the class path.", ex);
}
builder.addPropertyValue("targetObject", new RuntimeBeanReference(helper.getAttribute(element, RedissonNamespaceParserSupport.REMOTE_SERVICE_REF_ATTRIBUTE)));
builder.addPropertyValue("targetMethod", "register");
ManagedList args = new ManagedList();
args.add(apiClass);
args.add(new RuntimeBeanReference(helper.getAttribute(element, BeanDefinitionParserDelegate.BEAN_REF_ATTRIBUTE)));
String workers = null;
if (helper.hasAttribute(element, RedissonNamespaceParserSupport.CONCURRENT_WORKERS_ATTRIBUTE)) {
workers = helper.getAttribute(element, RedissonNamespaceParserSupport.CONCURRENT_WORKERS_ATTRIBUTE);
}
if (StringUtils.hasText(workers)) {
args.add(Integer.parseInt(workers));
}
if (helper.hasAttribute(element, RedissonNamespaceParserSupport.EXECUTOR_REF_ATTRIBUTE)) {
Assert.state(helper.hasAttribute(element, RedissonNamespaceParserSupport.CONCURRENT_WORKERS_ATTRIBUTE), "The \"" + RedissonNamespaceParserSupport.CONCURRENT_WORKERS_ATTRIBUTE + "\" attribute in \"" + RedissonNamespaceParserSupport.RPC_SERVER_ELEMENT + "\" element is required when \"" + RedissonNamespaceParserSupport.EXECUTOR_REF_ATTRIBUTE + "\" attribute is specified.");
args.add(new RuntimeBeanReference(helper.getAttribute(element, RedissonNamespaceParserSupport.EXECUTOR_REF_ATTRIBUTE)));
}
builder.addPropertyValue("arguments", args);
}
Aggregations