use of org.springframework.beans.factory.support.ManagedList in project motan by weibocom.
the class MotanBeanDefinitionParser method parseMultiRef.
@SuppressWarnings({ "unchecked", "rawtypes" })
private static void parseMultiRef(String property, String value, RootBeanDefinition beanDefinition, ParserContext parserContext) {
String[] values = value.split("\\s*[,]+\\s*");
ManagedList list = null;
for (int i = 0; i < values.length; i++) {
String v = values[i];
if (v != null && v.length() > 0) {
if (list == null) {
list = new ManagedList();
}
list.add(new RuntimeBeanReference(v));
}
}
beanDefinition.getPropertyValues().addPropertyValue(property, list);
}
use of org.springframework.beans.factory.support.ManagedList in project motan by weibocom.
the class MotanBeanDefinitionParser method parseMethods.
@SuppressWarnings({ "unchecked", "rawtypes" })
private static void parseMethods(String id, NodeList nodeList, RootBeanDefinition beanDefinition, ParserContext parserContext) throws ClassNotFoundException {
if (nodeList != null && nodeList.getLength() > 0) {
ManagedList methods = null;
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if (node instanceof Element) {
Element element = (Element) node;
if ("method".equals(node.getNodeName()) || "method".equals(node.getLocalName())) {
String methodName = element.getAttribute("name");
if (methodName == null || methodName.length() == 0) {
throw new IllegalStateException("<motan:method> name attribute == null");
}
if (methods == null) {
methods = new ManagedList();
}
BeanDefinition methodBeanDefinition = parse((Element) node, parserContext, MethodConfig.class, false);
String name = id + "." + methodName;
BeanDefinitionHolder methodBeanDefinitionHolder = new BeanDefinitionHolder(methodBeanDefinition, name);
methods.add(methodBeanDefinitionHolder);
}
}
}
if (methods != null) {
beanDefinition.getPropertyValues().addPropertyValue("methods", methods);
}
}
}
use of org.springframework.beans.factory.support.ManagedList in project leopard by tanhaichao.
the class ComponentScanBeanDefinitionParser method createTimerService.
protected BeanDefinition createTimerService() {
String className = "io.leopard.web.timer.TimerServiceImpl";
Class<?> clazz;
try {
clazz = Class.forName(className);
} catch (ClassNotFoundException e) {
return null;
}
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(clazz);
ManagedList<RuntimeBeanReference> timerBeanList = new ManagedList<RuntimeBeanReference>();
for (String beanName : timerList) {
timerBeanList.add(new RuntimeBeanReference(beanName));
}
builder.addPropertyValue("timers", timerBeanList);
builder.setScope(BeanDefinition.SCOPE_SINGLETON);
builder.setLazyInit(false);
return RegisterComponentUtil.registerComponent(parserContext, builder, "timerService");
}
use of org.springframework.beans.factory.support.ManagedList in project cxf by apache.
the class NettyHttpServerEngineFactoryBeanDefinitionParser 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 cxf by apache.
the class JettyHTTPServerEngineFactoryBeanDefinitionParser 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;
}
Aggregations