当前位置: 首页>>代码示例>>Java>>正文


Java ManagedSet.add方法代码示例

本文整理汇总了Java中org.springframework.beans.factory.support.ManagedSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java ManagedSet.add方法的具体用法?Java ManagedSet.add怎么用?Java ManagedSet.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.factory.support.ManagedSet的用法示例。


在下文中一共展示了ManagedSet.add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseSet

import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
/**
 * Parses a list of elements into a set of beans/standard content.
 *
 * @param grandChildren - The set of beans/content in a bean property
 * @param child - The property tag for the parent.
 * @param parent - The parent bean that the tag is nested in.
 * @param parserContext - Provided information and functionality regarding current bean set.
 * @return A managedSet of the nested content.
 */
protected ManagedSet parseSet(ArrayList<Element> grandChildren, Element child, BeanDefinitionBuilder parent,
        ParserContext parserContext) {
    ManagedSet setItems = new ManagedSet();

    for (int i = 0; i < grandChildren.size(); i++) {
        Element grandChild = grandChildren.get(i);

        if (child.getTagName().compareTo("value") == 0) {
            setItems.add(grandChild.getTextContent());
        } else {
            setItems.add(parseBean(grandChild, parent, parserContext));
        }
    }

    String merge = child.getAttribute("merge");
    if (merge != null) {
        setItems.setMergeEnabled(Boolean.valueOf(merge));
    }

    return setItems;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:CustomSchemaParser.java

示例2: visitSet

import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
/**
 * Iterates through the set values and calls helpers to process the value
 *
 * @param setVal the set to process
 * @param propertyName name of the property which has the set value
 * @param nestedBeanStack stack of bean containers which contains the set property
 */
protected void visitSet(Set setVal, String propertyName, Stack<BeanDefinitionHolder> nestedBeanStack) {
    boolean isMergeEnabled = false;
    if (setVal instanceof ManagedSet) {
        isMergeEnabled = ((ManagedSet) setVal).isMergeEnabled();
    }

    ManagedSet newSet = new ManagedSet();
    newSet.setMergeEnabled(isMergeEnabled);

    for (Object elem : setVal) {
        if (isStringValue(elem)) {
            elem = processSetStringPropertyValue(propertyName, setVal, getString(elem), nestedBeanStack,
                    beanProcessors);
        } else {
            elem = visitPropertyValue(propertyName, elem, nestedBeanStack);
        }

        newSet.add(elem);
    }

    setVal.clear();
    setVal.addAll(newSet);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:DictionaryBeanFactoryPostProcessor.java

示例3: parseLogsElement

import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
private void parseLogsElement(Element logsElement, BeanDefinitionBuilder factory, ParserContext ctx) {
    if (logsElement == null) {
        return;
    }

    List<Element> childElements = DomUtils.getChildElementsByTagName(logsElement, "log");

    ManagedSet<BeanDefinition> logs = new ManagedSet<BeanDefinition>(childElements.size());

    for (Element element : childElements) {

        BeanDefinition bd = ctx.getRegistry().getBeanDefinition(element.getAttribute("ref"));

        if (bd != null) {
            logs.add(bd);
        }
    }

    if (logs.size() != 0) {
        factory.addPropertyValue("eventLogs", logs);
    }
}
 
开发者ID:steven-zhc,项目名称:hummingbird-framework,代码行数:23,代码来源:CloudBeanDefinitionParser.java

示例4: parseFilterManagerElement

import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
@Override
public BeanDefinition parseFilterManagerElement(Element filterElement) {

    BeanDefinitionBuilder filterManagerFactory = BeanDefinitionBuilder.rootBeanDefinition(SimpleFilterManager.class);
    filterManagerFactory.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
    filterManagerFactory.setLazyInit(false);

    filterManagerFactory.addPropertyValue("type", getComponentName());

    List<Element> itemElements = DomUtils.getChildElementsByTagName(filterElement, "item");
    ManagedSet<BeanDefinition> items = new ManagedSet<BeanDefinition>(itemElements.size());

    for (Element element : itemElements) {
        BeanDefinition bd = parseItemElement(element);

        if (bd != null) {
            items.add(bd);
        }
    }
    filterManagerFactory.addPropertyValue("filters", items);

    return filterManagerFactory.getBeanDefinition();
}
 
开发者ID:steven-zhc,项目名称:hummingbird-framework,代码行数:24,代码来源:ComponentDefinitionParser.java

示例5: parseSet

import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
/**
 * Parses a list of elements into a set of beans/standard content.
 *
 * @param grandChildren - The set of beans/content in a bean property
 * @param child - The property tag for the parent.
 * @param parent - The parent bean that the tag is nested in.
 * @param parserContext - Provided information and functionality regarding current bean set.
 * @return A managedSet of the nested content.
 */
private ManagedSet parseSet(ArrayList<Element> grandChildren, Element child, BeanDefinitionBuilder parent,
        ParserContext parserContext) {
    ManagedSet setItems = new ManagedSet();

    for (int i = 0; i < grandChildren.size(); i++) {
        Element grandChild = grandChildren.get(i);

        if (child.getTagName().compareTo("spring:value") == 0) {
            setItems.add(grandChild.getTextContent());
        } else {
            setItems.add(parseBean(grandChild, parent, parserContext));
        }
    }

    String merge = child.getAttribute("merge");
    if (merge != null) {
        setItems.setMergeEnabled(Boolean.valueOf(merge));
    }

    return setItems;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:31,代码来源:CustomSchemaParser.java

示例6: parseFilterChain

import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
private String parseFilterChain(Element element, ParserContext parserContext) {
Element filterChain = DomUtils.getChildElementByTagName(element, AttributeNames.FILTER_CHAIN);
List<Element> filters = DomUtils.getChildElementsByTagName(filterChain, AttributeNames.FILTER);
BeanDefinitionBuilder filterChainBuilder = BeanDefinitionBuilder.genericBeanDefinition(FilterChain.class);
ManagedSet<BeanDefinition> filterBeanDefinitions = new ManagedSet<BeanDefinition>();
for (Element filter : filters) {
    String ref = filter.getAttribute(AttributeNames.REF);
    BeanDefinition filterDefinition = parserContext.getRegistry().getBeanDefinition(ref);
    filterBeanDefinitions.add(filterDefinition);
}
filterChainBuilder.addConstructorArgValue(filterBeanDefinitions);
String filterChainString = StringUtils.uncapitalize(FilterChain.class.getSimpleName());
parserContext.getRegistry().registerBeanDefinition(filterChainString, filterChainBuilder.getBeanDefinition());
return filterChainString;
   }
 
开发者ID:ilivoo,项目名称:game,代码行数:16,代码来源:NioServerBeanDefinitionParser.java

示例7: parseShardingDataSource

import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
private void parseShardingDataSource(Element element, ParserContext parserContext){
	BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(ShardingDataSourceRepositorySupport.class);
	Element partitionsElement= DomUtils.getChildElementByTagName(element, DATA_SOURCE_PARTITIONS);
	List<Element> partitions= DomUtils.getChildElementsByTagName(partitionsElement, DATA_SOURCE_PARTITION);
	ManagedSet<BeanDefinition> partitionDataSources  = new ManagedSet<BeanDefinition>();
	for(Element each: partitions){
		partitionDataSources.add(parseDataSourcePartition(each,parserContext));
	}
	factory.addPropertyValue("partitionDataSources", partitionDataSources);
	factory.addPropertyValue("databaseType", DatabaseType.valueOf(element.getAttribute(DATA_BASE_TYPE)));
	shardingDataSourceRepositoryDefinition= factory.getBeanDefinition();
}
 
开发者ID:balancebeam,项目名称:sherlock,代码行数:13,代码来源:ShardingDataSourceBeanDefinitionParser.java

示例8: visitSet

import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void visitSet(String propertyName, Map<String, String> parentPropertyExpressions,
        Map<String, String> propertyExpressions, Set setVal, ConfigurableListableBeanFactory beanFactory,
        Set<String> processedBeanNames) {
    boolean isMergeEnabled = false;
    if (setVal instanceof ManagedSet) {
        isMergeEnabled = ((ManagedSet) setVal).isMergeEnabled();
    }

    ManagedSet newSet = new ManagedSet();
    newSet.setMergeEnabled(isMergeEnabled);

    for (Object elem : setVal) {
        if (hasExpression(elem)) {
            String strValue = getStringValue(elem);
            propertyExpressions.put(propertyName + ExpressionEvaluator.EMBEDDED_PROPERTY_NAME_ADD_INDICATOR,
                    strValue);
        } else {
            // process set value bean definition as a top level bean
            if ((elem instanceof BeanDefinition) || (elem instanceof BeanDefinitionHolder)) {
                String beanName = null;
                BeanDefinition beanDefinition;
                if (elem instanceof BeanDefinition) {
                    beanDefinition = (BeanDefinition) elem;
                } else {
                    beanDefinition = ((BeanDefinitionHolder) elem).getBeanDefinition();
                    beanName = ((BeanDefinitionHolder) elem).getBeanName();
                }

                processBeanDefinition(beanName, beanDefinition, beanFactory, processedBeanNames);
            }

            newSet.add(elem);
        }
    }

    // determine if we need to clear any parent expressions for this list
    if (!isMergeEnabled) {
        // clear any expressions that match the property name minus index
        Map<String, String> adjustedParentExpressions = new HashMap<String, String>();
        for (Map.Entry<String, String> parentExpression : parentPropertyExpressions.entrySet()) {
            if (!parentExpression.getKey().startsWith(
                    propertyName + ExpressionEvaluator.EMBEDDED_PROPERTY_NAME_ADD_INDICATOR)) {
                adjustedParentExpressions.put(parentExpression.getKey(), parentExpression.getValue());
            }
        }

        parentPropertyExpressions.clear();
        parentPropertyExpressions.putAll(adjustedParentExpressions);
    }

    setVal.clear();
    setVal.addAll(newSet);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:55,代码来源:UifBeanFactoryPostProcessor.java

示例9: parseLifecycleElement

import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
private void parseLifecycleElement(Element lifecycleElement, BeanDefinitionBuilder factory) {
    if (lifecycleElement == null) {
        return;
    }

    List<Element> childElements = DomUtils.getChildElementsByTagName(lifecycleElement, "item");

    ManagedSet<BeanDefinition> items = new ManagedSet<BeanDefinition>(childElements.size());

    for (Element element : childElements) {

        BeanDefinition bd = parseItemElement(element);

        if (bd != null) {
            items.add(bd);
        }

    }

    factory.addPropertyValue("lifecycleListeners", items);
}
 
开发者ID:steven-zhc,项目名称:hummingbird-framework,代码行数:22,代码来源:CloudBeanDefinitionParser.java


注:本文中的org.springframework.beans.factory.support.ManagedSet.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。