當前位置: 首頁>>代碼示例>>Java>>正文


Java ManagedMap類代碼示例

本文整理匯總了Java中org.springframework.beans.factory.support.ManagedMap的典型用法代碼示例。如果您正苦於以下問題:Java ManagedMap類的具體用法?Java ManagedMap怎麽用?Java ManagedMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ManagedMap類屬於org.springframework.beans.factory.support包,在下文中一共展示了ManagedMap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseProperties

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
private Optional<Map<String, String>> parseProperties(Element el) {
    List<Element> propEls = subElements(el, "properties", "prop");

    if (!propEls.isEmpty()) {
        Map<String, String> props = new ManagedMap<>();

        for (Element propEl : propEls) {
            String name = propEl.getAttribute("name").trim();
            String value = getTextValue(propEl).trim();

            props.put(name, value);
        }

        return Optional.of(props);
    }

    return Optional.empty();
}
 
開發者ID:hekate-io,項目名稱:hekate,代碼行數:19,代碼來源:HekateBeanDefinitionParser.java

示例2: manageMapIfNecessary

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
/**
 * Checks whether there are any {@link RuntimeBeanReference}s inside the Map
 * and converts it to a ManagedMap if necessary.
 * @param map the original Map
 * @return either the original map or a managed copy of it
 */
private Object manageMapIfNecessary(Map<?, ?> map) {
	boolean containsRuntimeRefs = false;
	for (Object element : map.values()) {
		if (element instanceof RuntimeBeanReference) {
			containsRuntimeRefs = true;
			break;
		}
	}
	if (containsRuntimeRefs) {
		Map<Object, Object> managedMap = new ManagedMap<Object, Object>();
		managedMap.putAll(map);
		return managedMap;
	}
	return map;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:GroovyBeanDefinitionReader.java

示例3: postProcessBeanFactory

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void postProcessBeanFactory(
    ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
    String[] igniteConfigNames = configurableListableBeanFactory.getBeanNamesForType(IgniteConfiguration.class);
    if (igniteConfigNames.length != 1) {
        throw new IllegalArgumentException("Spring config must contain exactly one ignite configuration!");
    }
    String[] activeStoreConfigNames = configurableListableBeanFactory.getBeanNamesForType(BaseActiveStoreConfiguration.class);
    if (activeStoreConfigNames.length != 1) {
        throw new IllegalArgumentException("Spring config must contain exactly one active store configuration!");
    }
    BeanDefinition igniteConfigDef = configurableListableBeanFactory.getBeanDefinition(igniteConfigNames[0]);
    MutablePropertyValues propertyValues = igniteConfigDef.getPropertyValues();
    if (!propertyValues.contains(USER_ATTRS_PROP_NAME)) {
        propertyValues.add(USER_ATTRS_PROP_NAME, new ManagedMap());
    }
    PropertyValue propertyValue = propertyValues.getPropertyValue(USER_ATTRS_PROP_NAME);
    Map userAttrs = (Map)propertyValue.getValue();
    TypedStringValue key = new TypedStringValue(CONFIG_USER_ATTR);
    RuntimeBeanReference value = new RuntimeBeanReference(beanName);
    userAttrs.put(key, value);
}
 
開發者ID:epam,項目名稱:Lagerta,代碼行數:24,代碼來源:BaseActiveStoreConfiguration.java

示例4: manageMapIfNecessary

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
/**
 * Checks whether there are any {@link RuntimeBeanReference}s inside the {@link Map}
 * and converts it to a {@link ManagedMap} if necessary.
 * @param map the original Map
 * @return either the original map or a managed copy of it
 */
private Object manageMapIfNecessary(Map<?, ?> map) {
	boolean containsRuntimeRefs = false;
	for (Object element : map.values()) {
		if (element instanceof RuntimeBeanReference) {
			containsRuntimeRefs = true;
			break;
		}
	}
	if (containsRuntimeRefs) {
		Map<Object, Object> managedMap = new ManagedMap<Object, Object>();
		managedMap.putAll(map);
		return managedMap;
	}
	return map;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:22,代碼來源:GroovyBeanDefinitionReader.java

示例5: addMapping

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
@Override
public void addMapping(Element element, ManagedMap<String, Object> urlMap, ParserContext context) {
	String pathAttribute = element.getAttribute("path");
	List<String> mappings = Arrays.asList(StringUtils.tokenizeToStringArray(pathAttribute, ","));
	RuntimeBeanReference handlerReference = new RuntimeBeanReference(element.getAttribute("handler"));

	ConstructorArgumentValues cavs = new ConstructorArgumentValues();
	cavs.addIndexedArgumentValue(0, handlerReference);
	if (this.handshakeHandlerReference != null) {
		cavs.addIndexedArgumentValue(1, this.handshakeHandlerReference);
	}
	RootBeanDefinition requestHandlerDef = new RootBeanDefinition(WebSocketHttpRequestHandler.class, cavs, null);
	requestHandlerDef.setSource(context.extractSource(element));
	requestHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	requestHandlerDef.getPropertyValues().add("handshakeInterceptors", this.interceptorsList);
	String requestHandlerName = context.getReaderContext().registerWithGeneratedName(requestHandlerDef);
	RuntimeBeanReference requestHandlerRef = new RuntimeBeanReference(requestHandlerName);

	for (String mapping : mappings) {
		urlMap.put(mapping, requestHandlerRef);
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:23,代碼來源:HandlersBeanDefinitionParser.java

示例6: registerHandlerMapping

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
private ManagedMap<String, Object> registerHandlerMapping(Element element,
		ParserContext context, Object source) {

	RootBeanDefinition handlerMappingDef = new RootBeanDefinition(WebSocketHandlerMapping.class);

	String orderAttribute = element.getAttribute("order");
	int order = orderAttribute.isEmpty() ? DEFAULT_MAPPING_ORDER : Integer.valueOf(orderAttribute);
	handlerMappingDef.getPropertyValues().add("order", order);

	String pathHelper = element.getAttribute("path-helper");
	if (StringUtils.hasText(pathHelper)) {
		handlerMappingDef.getPropertyValues().add("urlPathHelper", new RuntimeBeanReference(pathHelper));
	}

	ManagedMap<String, Object> urlMap = new ManagedMap<String, Object>();
	urlMap.setSource(source);
	handlerMappingDef.getPropertyValues().add("urlMap", urlMap);

	registerBeanDef(handlerMappingDef, context, source);
	return urlMap;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:22,代碼來源:MessageBrokerBeanDefinitionParser.java

示例7: doParse

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
protected void doParse(Element element, BeanDefinitionBuilder bean) {
    final Map<Object, Object> configuration = new ManagedMap<>();
    final Node keywordValueNode = element
        .getElementsByTagNameNS("http://xdcrafts.github.com/schema/flower", "keyword-value")
        .item(0);
    final Node predicateNode = element
        .getElementsByTagNameNS("http://xdcrafts.github.com/schema/flower", "predicate")
        .item(0);
    if (keywordValueNode != null) {
        configuration.put("keyword-value", keywordValueNode.getTextContent());
    }
    if (predicateNode != null) {
        configuration.put("predicate", new RuntimeBeanReference(predicateNode.getTextContent()));
    }
    bean
        .addPropertyReference("action", element.getAttribute("action"))
        .addPropertyValue("configuration", configuration);
}
 
開發者ID:xdcrafts,項目名稱:flower,代碼行數:19,代碼來源:ExtensionBeanDefinitionHandler.java

示例8: doParse

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
protected void doParse(Element element, BeanDefinitionBuilder bean) {
    final ManagedMap<Object, Object> extensions = new ManagedMap<>();
    final NodeList bindingNodes = element
        .getElementsByTagNameNS("http://xdcrafts.github.com/schema/flower", "binding");
    if (bindingNodes != null && bindingNodes.getLength() != 0) {
        for (int i = 0; i < bindingNodes.getLength(); i++) {
            final Node bindingNode = bindingNodes.item(i);
            final String extension = bindingNode
                .getAttributes()
                .getNamedItem("extension")
                .getNodeValue();
            final String selector = bindingNode
                .getAttributes()
                .getNamedItem("selector")
                .getNodeValue();
            extensions.put(new RuntimeBeanReference(extension), new RuntimeBeanReference(selector));
        }
    }
    bean.addPropertyValue("extensions", extensions);
}
 
開發者ID:xdcrafts,項目名稱:flower,代碼行數:21,代碼來源:FeatureBeanDefinitionHandler.java

示例9: getExpressionGraphFromParent

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
/**
 * Retrieves the expression graph map set on the bean with given name. If the bean has not been processed
 * by the bean factory post processor, that is done before retrieving the map
 *
 * @param parentBeanName name of the parent bean to retrieve map for (if empty a new map will be returned)
 * @param beanFactory bean factory to retrieve bean definition from
 * @param processedBeanNames set of bean names that have been processed so far
 * @return expression graph map from parent or new instance
 */
protected Map<String, String> getExpressionGraphFromParent(String parentBeanName,
        ConfigurableListableBeanFactory beanFactory, Set<String> processedBeanNames) {
    Map<String, String> expressionGraph = new HashMap<String, String>();
    if (StringUtils.isBlank(parentBeanName) || !beanFactory.containsBeanDefinition(parentBeanName)) {
        return expressionGraph;
    }

    BeanDefinition beanDefinition = beanFactory.getBeanDefinition(parentBeanName);
    if (!processedBeanNames.contains(parentBeanName)) {
        processBeanDefinition(parentBeanName, beanDefinition, beanFactory, processedBeanNames);
    }

    MutablePropertyValues pvs = beanDefinition.getPropertyValues();
    PropertyValue propertyExpressionsPV = pvs.getPropertyValue(UifPropertyPaths.EXPRESSION_GRAPH);
    if (propertyExpressionsPV != null) {
        Object value = propertyExpressionsPV.getValue();
        if ((value != null) && (value instanceof ManagedMap)) {
            expressionGraph.putAll((ManagedMap) value);
        }
    }

    return expressionGraph;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:33,代碼來源:UifBeanFactoryPostProcessor.java

示例10: parseMap

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
/**
 * Parses a list of elements into a map of beans/standard content.
 *
 * @param grandChildren - The list 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 ManagedMap parseMap(ArrayList<Element> grandChildren, Element child, BeanDefinitionBuilder parent,
        ParserContext parserContext) {
    ManagedMap map = new ManagedMap();

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

    for (int j = 0; j < grandChildren.size(); j++) {
        Object key = findKey(grandChildren.get(j), parent, parserContext);
        Object value = findValue(grandChildren.get(j), parent, parserContext);

        map.put(key, value);
    }

    return map;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:28,代碼來源:CustomSchemaParser.java

示例11: createGroupRegistryDefinition

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
private BeanDefinition createGroupRegistryDefinition(String name,
		Element element) {
	ManagedMap<String, BeanDefinition> ptpGroupsMap = new ManagedMap<String, BeanDefinition>();

	String currentGroupName = ParticipantsGroupRegistry.GROUPS_REGISTRY__ROOT_GROUPNAME;
	ManagedList<BeanDefinition> rootGrpParticipants = registerGroup(
			ptpGroupsMap, currentGroupName);
	processGroup(ptpGroupsMap, element, currentGroupName,
			rootGrpParticipants);

	RootBeanDefinition grpRegistryDef = new RootBeanDefinition(
			ParticipantsGroupRegistry.class);
	ConstructorArgumentValues cav = grpRegistryDef
			.getConstructorArgumentValues();
	cav.addGenericArgumentValue(ptpGroupsMap);

	return grpRegistryDef;
}
 
開發者ID:dgrandemange,項目名稱:txnmgr-springframework-ext,代碼行數:19,代碼來源:TransactionManagerBeanDefinitionParser.java

示例12: parseFields

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
public void parseFields(Element element, RootBeanDefinition beandef, ParserContext parserContext) {
	Element fieldsele = DomUtils.getChildElementByTagName(element, FIELDS);
	if (fieldsele == null) {
		return;
	}
	List<Element> fieldlist = DomUtils.getChildElementsByTagName(fieldsele, FIELD);
	if (fieldlist.size() == 0) {
		return;
	}
	Map<String, RuntimeBeanReference> fields = new ManagedMap<String, RuntimeBeanReference>();
	String fieldname = null;
	for (Element field : fieldlist) {
		fieldname = field.getAttribute(NAME);
		if (!(StringUtils.hasLength(fieldname))) {
			System.out.println("Tag 'field' must have a 'name' attribute");
			return;
		}
		if("".equals(DomUtils.getTextValue(field))){
			fields.put(fieldname, null);
		} else {
			fields.put(fieldname, new RuntimeBeanReference(DomUtils.getTextValue(field)));
		}
	}
	beandef.getPropertyValues().addPropertyValue(FIELDS, fields);
}
 
開發者ID:yaneri,項目名稱:se,代碼行數:26,代碼來源:TransactionBeanDefinitionParser.java

示例13: createStream

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
private XStream createStream() {
	XStream stream = new XStream();
	stream.registerConverter(new BeanDefinitionConverter(stream.getMapper()));
	stream.registerConverter(new BeanDefinitionHolderConverter(stream.getMapper()));
	stream.registerConverter(new TypedStringValueConverter());
	stream.registerConverter(new ManagedCollectionConverter(stream.getMapper()));
	stream.registerConverter(new ManagedMapConverter(stream.getMapper()));
	stream.registerConverter(new RuntimeBeanReferenceConverter());
	stream.alias("map", ManagedMap.class);
	stream.alias("list", ManagedList.class);
	stream.alias("set", ManagedSet.class);
	stream.alias("array", ManagedArray.class);
	stream.aliasType("bean", BeanDefinition.class);
	stream.alias("bean", BeanDefinitionHolder.class);
	stream.alias("ref", RuntimeBeanReference.class);
	return stream;
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:18,代碼來源:BeanDefinitionWriterServiceImpl.java

示例14: marshal

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
	ManagedMap<?, ?> map = (ManagedMap<?, ?>) source;
	for (Map.Entry<?, ?> entry : map.entrySet()) {
		writer.startNode("entry");
		writer.startNode("key");
		if (entry.getKey().getClass().equals(TypedStringValue.class)) {
			writer.startNode("value");
			writer.setValue(((TypedStringValue) entry.getKey()).getValue());
			writer.endNode();
		} else {
			writeItem(entry.getKey(), context, writer);
		}
		writer.endNode();
		if (entry.getValue().getClass().equals(TypedStringValue.class)) {
			writer.startNode("value");
			writer.setValue(((TypedStringValue) entry.getValue()).getValue());
			writer.endNode();
		} else {
			writeItem(entry.getValue(), context, writer);
		}
		writer.endNode();
	}
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:24,代碼來源:BeanDefinitionWriterServiceImpl.java

示例15: parseMap

import org.springframework.beans.factory.support.ManagedMap; //導入依賴的package包/類
/**
 * Parses a list of elements into a map of beans/standard content.
 *
 * @param grandChildren - The list 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 ManagedMap parseMap(ArrayList<Element> grandChildren, Element child, BeanDefinitionBuilder parent,
        ParserContext parserContext) {
    ManagedMap map = new ManagedMap();
    String merge = child.getAttribute("merge");

    for (int j = 0; j < grandChildren.size(); j++) {
        Object key = findKey(grandChildren.get(j));
        Object value = findValue(grandChildren.get(j));
        map.put(key, value);
    }

    if (merge != null) {
        map.setMergeEnabled(Boolean.valueOf(merge));
    }

    return map;
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:27,代碼來源:CustomSchemaParser.java


注:本文中的org.springframework.beans.factory.support.ManagedMap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。