本文整理汇总了Java中org.springframework.beans.factory.support.ManagedList.add方法的典型用法代码示例。如果您正苦于以下问题:Java ManagedList.add方法的具体用法?Java ManagedList.add怎么用?Java ManagedList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.factory.support.ManagedList
的用法示例。
在下文中一共展示了ManagedList.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addIncludePatterns
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private void addIncludePatterns(Element element, ParserContext parserContext, BeanDefinition beanDef) {
ManagedList<TypedStringValue> includePatterns = new ManagedList<TypedStringValue>();
NodeList childNodes = element.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if (node instanceof Element) {
Element includeElement = (Element) node;
TypedStringValue valueHolder = new TypedStringValue(includeElement.getAttribute("name"));
valueHolder.setSource(parserContext.extractSource(includeElement));
includePatterns.add(valueHolder);
}
}
if (!includePatterns.isEmpty()) {
includePatterns.setSource(parserContext.extractSource(element));
beanDef.getPropertyValues().add("includePatterns", includePatterns);
}
}
示例2: parseServerConfig
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private String parseServerConfig(Element element, ParserContext parserContext) {
Element ipconfigs = DomUtils.getChildElementByTagName(element, AttributeNames.IPCONFIGS);
List<Element> ips = DomUtils.getChildElementsByTagName(ipconfigs, AttributeNames.IPCONFIG);
BeanDefinitionBuilder serverConfigBuilder = BeanDefinitionBuilder.genericBeanDefinition(ServerConfig.class);
serverConfigBuilder.addConstructorArgValue(element.getAttribute(AttributeNames.READ_SIZE));
serverConfigBuilder.addConstructorArgValue(element.getAttribute(AttributeNames.WRITE_SIZE));
ManagedList<BeanDefinition> inetSocketAddress = new ManagedList<BeanDefinition>();
for (Element ip : ips) {
BeanDefinitionBuilder inetBuilder = BeanDefinitionBuilder.genericBeanDefinition(IpConfig.class);
inetBuilder.addConstructorArgValue(ip.getAttribute(AttributeNames.HOST_NAME));
inetBuilder.addConstructorArgValue(ip.getAttribute(AttributeNames.PORT));
inetSocketAddress.add(inetBuilder.getBeanDefinition());
}
serverConfigBuilder.addConstructorArgValue(inetSocketAddress);
String serverConfig = StringUtils.uncapitalize(ServerConfig.class.getSimpleName());
parserContext.getRegistry().registerBeanDefinition(serverConfig, serverConfigBuilder.getBeanDefinition());
return serverConfig;
}
示例3: doParse
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder beanDefinitionBuilder) {
String contextPath = element.getAttribute("context-path");
if (!StringUtils.hasText(contextPath)) {
// Backwards compatibility with 3.x version of the xsd
contextPath = element.getAttribute("contextPath");
}
if (StringUtils.hasText(contextPath)) {
beanDefinitionBuilder.addPropertyValue("contextPath", contextPath);
}
List<Element> classes = DomUtils.getChildElementsByTagName(element, "class-to-be-bound");
if (!classes.isEmpty()) {
ManagedList<String> classesToBeBound = new ManagedList<String>(classes.size());
for (Element classToBeBound : classes) {
String className = classToBeBound.getAttribute("name");
classesToBeBound.add(className);
}
beanDefinitionBuilder.addPropertyValue("classesToBeBound", classesToBeBound);
}
}
示例4: parseLogicChildTable
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private BeanDefinition parseLogicChildTable(Element element,ParserContext parserContext){
BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(LogicChildTableConfig.class);
factory.addPropertyValue("name", element.getAttribute(TABLE_NAME));
String primaryKey= element.getAttribute(PRIMARY_KEY);
if(!StringUtils.isEmpty(primaryKey)){
factory.addPropertyValue("primaryKey", primaryKey);
}
String foreignKey= element.getAttribute(FOREIGN_KEY);
if(!StringUtils.isEmpty(foreignKey)){
factory.addPropertyValue("foreignKey", foreignKey);
}
List<Element> logicChildTableElements= DomUtils.getChildElementsByTagName(element, LOGIC_CHILD_TABLE);
if(!CollectionUtils.isEmpty(logicChildTableElements)){
ManagedList<BeanDefinition> children= new ManagedList<BeanDefinition>();
for(Element each: logicChildTableElements){
children.add(parseLogicChildTable(each,parserContext));
}
factory.addPropertyValue("children", children);
}
return factory.getBeanDefinition();
}
示例5: createTimerService
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
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");
}
示例6: getCallableInterceptors
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private ManagedList<?> getCallableInterceptors(Element element, Object source, ParserContext parserContext) {
ManagedList<? super Object> interceptors = new ManagedList<Object>();
Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support");
if (asyncElement != null) {
Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "callable-interceptors");
if (interceptorsElement != null) {
interceptors.setSource(source);
for (Element converter : DomUtils.getChildElementsByTagName(interceptorsElement, "bean")) {
BeanDefinitionHolder beanDef = parserContext.getDelegate().parseBeanDefinitionElement(converter);
beanDef = parserContext.getDelegate().decorateBeanDefinitionIfRequired(converter, beanDef);
interceptors.add(beanDef);
}
}
}
return interceptors;
}
示例7: getDeferredResultInterceptors
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private ManagedList<?> getDeferredResultInterceptors(Element element, Object source, ParserContext parserContext) {
ManagedList<? super Object> interceptors = new ManagedList<Object>();
Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support");
if (asyncElement != null) {
Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "deferred-result-interceptors");
if (interceptorsElement != null) {
interceptors.setSource(source);
for (Element converter : DomUtils.getChildElementsByTagName(interceptorsElement, "bean")) {
BeanDefinitionHolder beanDef = parserContext.getDelegate().parseBeanDefinitionElement(converter);
beanDef = parserContext.getDelegate().decorateBeanDefinitionIfRequired(converter, beanDef);
interceptors.add(beanDef);
}
}
}
return interceptors;
}
示例8: wrapLegacyResolvers
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private ManagedList<Object> wrapLegacyResolvers(List<Object> list, ParserContext context) {
ManagedList<Object> result = new ManagedList<Object>();
for (Object object : list) {
if (object instanceof BeanDefinitionHolder) {
BeanDefinitionHolder beanDef = (BeanDefinitionHolder) object;
String className = beanDef.getBeanDefinition().getBeanClassName();
Class<?> clazz = ClassUtils.resolveClassName(className, context.getReaderContext().getBeanClassLoader());
if (WebArgumentResolver.class.isAssignableFrom(clazz)) {
RootBeanDefinition adapter = new RootBeanDefinition(ServletWebArgumentResolverAdapter.class);
adapter.getConstructorArgumentValues().addIndexedArgumentValue(0, beanDef);
result.add(new BeanDefinitionHolder(adapter, beanDef.getBeanName() + "Adapter"));
continue;
}
}
result.add(object);
}
return result;
}
示例9: handleModifierElements
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked","rawtypes"})
private void handleModifierElements(Element element, ParserContext parserContext,
BeanDefinitionBuilder builder, ModifierElement modifierElementEnum) {
List<Element> modifiers = DomUtils.getChildElementsByTagName(element,
modifierElementEnum.name().toLowerCase() + "-modifier");
if (modifiers.isEmpty()) {
return;
}
ManagedList managedModifiers = new ManagedList();
for (Element modifierElement : modifiers) {
managedModifiers.add(parserContext.getDelegate().parsePropertySubElement(
modifierElement,
builder.getRawBeanDefinition(),
null));
}
builder.addPropertyValue("default" + modifierElementEnum.name() + "Modifiers",
managedModifiers);
}
示例10: visitList
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
/**
* Iterates through the list values and calls helpers to process the value
*
* @param listVal the list to process
* @param propertyName name of the property which has the list value
* @param nestedBeanStack stack of bean containers which contains the list property
*/
protected void visitList(List<?> listVal, String propertyName, Stack<BeanDefinitionHolder> nestedBeanStack) {
boolean isMergeEnabled = false;
if (listVal instanceof ManagedList) {
isMergeEnabled = ((ManagedList) listVal).isMergeEnabled();
}
ManagedList newList = new ManagedList();
newList.setMergeEnabled(isMergeEnabled);
for (int i = 0; i < listVal.size(); i++) {
Object elem = listVal.get(i);
if (isStringValue(elem)) {
elem = processListStringPropertyValue(propertyName, listVal, getString(elem), i, nestedBeanStack,
beanProcessors);
} else {
elem = visitPropertyValue(propertyName, elem, nestedBeanStack);
}
newList.add(i, elem);
}
listVal.clear();
listVal.addAll(newList);
}
示例11: parseSlaveDataSources
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private void parseSlaveDataSources(
List<Element> slaveElements,
BeanDefinitionBuilder masterSlaveDataSourceBeanDefinitionBuilder,
ParserContext parserContext,
String masterSlaveDataSourceId,
String dataSourcePrototypeAttributeValue)
{
ManagedList<AbstractBeanDefinition> slaveBeanDefinitions = new ManagedList<AbstractBeanDefinition>(slaveElements.size());
int index=0;
for (Element slaveElement : slaveElements)
{
index++;
AbstractBeanDefinition slaveBeanDefinition=this.createSlaveBeanDefinition(
index,
slaveElement,
masterSlaveDataSourceId,
dataSourcePrototypeAttributeValue,
parserContext);
slaveBeanDefinitions.add(slaveBeanDefinition);
}
masterSlaveDataSourceBeanDefinitionBuilder.addPropertyValue(MasterSlaveDataSource.SLAVE_DATA_SOURCES_PROPERTY_NAME, slaveBeanDefinitions);
}
示例12: createCacheCollection
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private ManagedList<Object> createCacheCollection(Element element, ParserContext parserContext) {
ManagedList<Object> caches = new ManagedList<>();
List<Element> cacheElements = DomUtils.getChildElements(element);
for (Element cacheElement : cacheElements) {
String elementName = cacheElement.getLocalName();
switch (elementName) {
case CACHE_REF_ELEMENT_NAME:
caches.add(new RuntimeBeanReference(cacheElement.getAttribute("ref")));
break;
case CACHE_CLUSTER_ELEMENT_NAME:
String cacheClusterId = getRequiredAttribute("name", cacheElement, parserContext);
caches.add(createElastiCacheFactoryBean(cacheElement, parserContext, cacheClusterId, createDefaultCacheFactories(cacheElement, parserContext)));
break;
default:
parserContext.getReaderContext().error("Unknown element detected", parserContext.extractSource(cacheElement));
}
}
return caches;
}
示例13: doParse
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder beanDefinitionBuilder) {
String contextPath = element.getAttribute("contextPath");
if (StringUtils.hasText(contextPath)) {
beanDefinitionBuilder.addPropertyValue("contextPath", contextPath);
}
List classes = DomUtils.getChildElementsByTagName(element, "class-to-be-bound");
if (!classes.isEmpty()) {
ManagedList classesToBeBound = new ManagedList(classes.size());
for (Iterator iterator = classes.iterator(); iterator.hasNext();) {
Element classToBeBound = (Element) iterator.next();
String className = classToBeBound.getAttribute("name");
classesToBeBound.add(className);
}
beanDefinitionBuilder.addPropertyValue("classesToBeBound", classesToBeBound);
}
}
示例14: parseProperty
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
protected BeanDefinition parseProperty(Element sElement, ParserContext sParserContext) {
BeanDefinitionBuilder aBuilder = BeanDefinitionBuilder.genericBeanDefinition(PropertyDefinitionFactoryBean.class);
aBuilder.addPropertyValue("localName", sElement.getAttribute(PROPDEF_LOCALNAME));
String aConverterID = sElement.getAttribute(PROPDEF_CONVERTERREF);
if (StringUtils.hasText(aConverterID)) {
aBuilder.addPropertyReference("converter", aConverterID);
}
List<Element> aValuesElements = DomUtils.getChildElementsByTagName(sElement, PROPDEF_VALUE);
ManagedList<String> aValues = new ManagedList<String>(aValuesElements.size());
for (Element aElement : aValuesElements) {
aValues.add(aElement.getTextContent());
}
aBuilder.addPropertyValue("values", aValues);
return aBuilder.getBeanDefinition();
}
示例15: parseList
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
protected ManagedList parseList(Element element, String childElementName, AbstractDefinitionParser.ParseDelegate parserDelegate) {
ManagedList managedList = new ManagedList();
List<Element> childDomElements = DomUtils.getChildElementsByTagName(element, childElementName);
for (Element childDomElement: childDomElements) {
if (hasAttribute(childDomElement, "value-ref")) {
if (!isMuleExpression(childDomElement.getAttribute("value-ref"))) {
managedList.add(new RuntimeBeanReference(childDomElement.getAttribute("value-ref")));
} else {
managedList.add(childDomElement.getAttribute("value-ref"));
}
} else {
managedList.add(parserDelegate.parse(childDomElement));
}
}
return managedList;
}