本文整理匯總了Java中org.springframework.beans.factory.support.ManagedMap.put方法的典型用法代碼示例。如果您正苦於以下問題:Java ManagedMap.put方法的具體用法?Java ManagedMap.put怎麽用?Java ManagedMap.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.beans.factory.support.ManagedMap
的用法示例。
在下文中一共展示了ManagedMap.put方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
示例2: 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);
}
示例3: 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;
}
示例4: 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;
}
示例5: parseFtplets
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
/**
* Parse the "ftplets" element
*/
private Map<?, ?> parseFtplets(final Element childElm,
final ParserContext parserContext,
final BeanDefinitionBuilder builder) {
List<Element> childs = SpringUtil.getChildElements(childElm);
if(childs.size() > 0 && childs.get(0).getLocalName().equals("map")) {
// using a beans:map element
return parserContext.getDelegate().parseMapElement(
childs.get(0),
builder.getBeanDefinition());
} else {
ManagedMap ftplets = new ManagedMap();
for (Element ftpletElm : childs) {
ftplets
.put(ftpletElm.getAttribute("name"), SpringUtil
.parseSpringChildElement(ftpletElm, parserContext,
builder));
}
return ftplets;
}
}
示例6: buildParameters
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
private ManagedMap buildParameters(String[] keyValues) {
if (keyValues.length == 0 || keyValues.length % 2 != 0) {
return null;
}
ManagedMap managedMap = new ManagedMap();
for (int i = 0; i < keyValues.length; i+=2) {
managedMap.put(keyValues[i], new TypedStringValue(keyValues[i + 1], String.class));
}
return managedMap;
}
開發者ID:justice-code,項目名稱:dubbo-spring-boot-autoconfig,代碼行數:13,代碼來源:DubboServiceClassPathBeanDefinitionScanner.java
示例7: visitMap
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
/**
* Iterates through the map values and calls helpers to process the value
*
* @param mapVal the set to process
* @param propertyName name of the property which has the map value
* @param nestedBeanStack stack of bean containers which contains the map property
*/
protected void visitMap(Map<?, ?> mapVal, String propertyName, Stack<BeanDefinitionHolder> nestedBeanStack) {
boolean isMergeEnabled = false;
if (mapVal instanceof ManagedMap) {
isMergeEnabled = ((ManagedMap) mapVal).isMergeEnabled();
}
ManagedMap newMap = new ManagedMap();
newMap.setMergeEnabled(isMergeEnabled);
for (Map.Entry entry : mapVal.entrySet()) {
Object key = entry.getKey();
Object val = entry.getValue();
if (isStringValue(val)) {
val = processMapStringPropertyValue(propertyName, mapVal, getString(val), key, nestedBeanStack,
beanProcessors);
} else {
val = visitPropertyValue(propertyName, val, nestedBeanStack);
}
newMap.put(key, val);
}
mapVal.clear();
mapVal.putAll(newMap);
}
示例8: registerGroup
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
protected ManagedList<BeanDefinition> registerGroup(
ManagedMap<String, BeanDefinition> ptpGroupsMap, String groupName) {
ManagedList<BeanDefinition> grpParticipants = new ManagedList<BeanDefinition>();
BeanDefinitionBuilder rootGrpDefBuilder = BeanDefinitionBuilder
.rootBeanDefinition(ParticipantsGroup.class);
ConstructorArgumentValues constructorArgumentValues = rootGrpDefBuilder
.getBeanDefinition().getConstructorArgumentValues();
constructorArgumentValues.addGenericArgumentValue(groupName);
constructorArgumentValues.addGenericArgumentValue(grpParticipants);
ptpGroupsMap.put(groupName, rootGrpDefBuilder.getBeanDefinition());
return grpParticipants;
}
開發者ID:dgrandemange,項目名稱:txnmgr-springframework-ext,代碼行數:16,代碼來源:TransactionManagerBeanDefinitionParser.java
示例9: createInjectionsMap
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
/**
* Creates a <code>Map</code> which contains all the defined injections. The
* map is a <code>ManagedMap</code>, so that the references will be
* resolved.
*
* @param element
* the parent element which contains all the injections
* @param parserContext
* the <code>ParserContext</code>
*
* @return the <code>Map</code> containing the beans to be injected
*
* @see ParserContext
* @see ManagedMap
*/
protected Map<?, ?> createInjectionsMap(final Element element,
final ParserContext parserContext) {
final List<Element> injEls = DomUtils.getChildElementsByTagName(
element, XML_ELEMENT_INJECT);
// create the map
final ManagedMap<Object, Object> map = new ManagedMap<Object, Object>(
injEls.size());
map.setSource(parserContext.extractSource(element));
map.setKeyTypeName(String.class.getName());
map.setValueTypeName(Object.class.getName());
map.setMergeEnabled(false);
// insert the values
for (final Element injEl : injEls) {
final String innerId = injEl.getAttribute(XML_ATTRIBUTE_INNERID);
final String outerId = injEl.getAttribute(XML_ATTRIBUTE_OUTERID);
// generate the reference
final RuntimeBeanReference ref = new RuntimeBeanReference(outerId);
ref.setSource(parserContext.extractSource(injEl));
// add it
map.put(innerId, ref);
}
return map;
}
示例10: getProtocols
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
private ManagedMap<String, RuntimeBeanReference> getProtocols(Element protocolHandler) {
ManagedMap<String, RuntimeBeanReference> protocolList = new ManagedMap<String, RuntimeBeanReference>();
List<Element> protocols = WebSocketXmlNamespaceHandler.getChildElementsByName(protocolHandler, "protocol");
if(!protocols.isEmpty()) {
for (Element protocolRefElement : protocols) {
protocolList.put(protocolRefElement.getAttribute("name"), new RuntimeBeanReference(protocolRefElement.getAttributes().getNamedItem("ref").getTextContent()));
}
}
return protocolList;
}
示例11: doParse
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
protected void doParse(final Element element,
final ParserContext parserContext,
final BeanDefinitionBuilder builder) {
BeanDefinitionBuilder factoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(CommandFactoryFactory.class);
ManagedMap commands = new ManagedMap();
List<Element> childs = SpringUtil.getChildElements(element);
for (Element commandElm : childs) {
String name = commandElm.getAttribute("name");
Object bean = SpringUtil.parseSpringChildElement(commandElm,
parserContext, builder);
commands.put(name, bean);
}
factoryBuilder.addPropertyValue("commandMap", commands);
if (StringUtils.hasText(element.getAttribute("use-default"))) {
factoryBuilder.addPropertyValue("useDefaultCommands", Boolean
.valueOf(element.getAttribute("use-default")));
}
BeanDefinition factoryDefinition = factoryBuilder.getBeanDefinition();
String factoryId = parserContext.getReaderContext().generateBeanName(factoryDefinition);
BeanDefinitionHolder factoryHolder = new BeanDefinitionHolder(factoryDefinition, factoryId);
registerBeanDefinition(factoryHolder, parserContext.getRegistry());
// set the factory on the listener bean
builder.getRawBeanDefinition().setFactoryBeanName(factoryId);
builder.getRawBeanDefinition().setFactoryMethodName("createCommandFactory");
}
示例12: parseListeners
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
/**
* Parse listeners elements
*/
@SuppressWarnings("unchecked")
private Map<?, ?> parseListeners(final Element listenersElm,
final ParserContext parserContext,
final BeanDefinitionBuilder builder) {
ManagedMap listeners = new ManagedMap();
List<Element> childs = SpringUtil.getChildElements(listenersElm);
for (Element listenerElm : childs) {
Object listener = null;
String ln = listenerElm.getLocalName();
if ("nio-listener".equals(ln)) {
listener = parserContext.getDelegate().parseCustomElement(
listenerElm, builder.getBeanDefinition());
} else if ("listener".equals(ln)) {
listener = SpringUtil.parseSpringChildElement(listenerElm,
parserContext, builder);
} else {
throw new FtpServerConfigurationException(
"Unknown listener element " + ln);
}
String name = listenerElm.getAttribute("name");
listeners.put(name, listener);
}
return listeners;
}
示例13: parseAttributeSource
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
private RootBeanDefinition parseAttributeSource(Element attrEle, ParserContext parserContext) {
List<Element> methods = DomUtils.getChildElementsByTagName(attrEle, METHOD_ELEMENT);
ManagedMap<TypedStringValue, RuleBasedTransactionAttribute> transactionAttributeMap =
new ManagedMap<TypedStringValue, RuleBasedTransactionAttribute>(methods.size());
transactionAttributeMap.setSource(parserContext.extractSource(attrEle));
for (Element methodEle : methods) {
String name = methodEle.getAttribute(METHOD_NAME_ATTRIBUTE);
TypedStringValue nameHolder = new TypedStringValue(name);
nameHolder.setSource(parserContext.extractSource(methodEle));
RuleBasedTransactionAttribute attribute = new RuleBasedTransactionAttribute();
String propagation = methodEle.getAttribute(PROPAGATION_ATTRIBUTE);
String isolation = methodEle.getAttribute(ISOLATION_ATTRIBUTE);
String timeout = methodEle.getAttribute(TIMEOUT_ATTRIBUTE);
String readOnly = methodEle.getAttribute(READ_ONLY_ATTRIBUTE);
if (StringUtils.hasText(propagation)) {
attribute.setPropagationBehaviorName(RuleBasedTransactionAttribute.PREFIX_PROPAGATION + propagation);
}
if (StringUtils.hasText(isolation)) {
attribute.setIsolationLevelName(RuleBasedTransactionAttribute.PREFIX_ISOLATION + isolation);
}
if (StringUtils.hasText(timeout)) {
try {
attribute.setTimeout(Integer.parseInt(timeout));
}
catch (NumberFormatException ex) {
parserContext.getReaderContext().error("Timeout must be an integer value: [" + timeout + "]", methodEle);
}
}
if (StringUtils.hasText(readOnly)) {
attribute.setReadOnly(Boolean.valueOf(methodEle.getAttribute(READ_ONLY_ATTRIBUTE)));
}
List<RollbackRuleAttribute> rollbackRules = new LinkedList<RollbackRuleAttribute>();
if (methodEle.hasAttribute(ROLLBACK_FOR_ATTRIBUTE)) {
String rollbackForValue = methodEle.getAttribute(ROLLBACK_FOR_ATTRIBUTE);
addRollbackRuleAttributesTo(rollbackRules,rollbackForValue);
}
if (methodEle.hasAttribute(NO_ROLLBACK_FOR_ATTRIBUTE)) {
String noRollbackForValue = methodEle.getAttribute(NO_ROLLBACK_FOR_ATTRIBUTE);
addNoRollbackRuleAttributesTo(rollbackRules,noRollbackForValue);
}
attribute.setRollbackRules(rollbackRules);
transactionAttributeMap.put(nameHolder, attribute);
}
RootBeanDefinition attributeSourceDefinition = new RootBeanDefinition(NameMatchTransactionAttributeSource.class);
attributeSourceDefinition.setSource(parserContext.extractSource(attrEle));
attributeSourceDefinition.getPropertyValues().add("nameMap", transactionAttributeMap);
return attributeSourceDefinition;
}
示例14: parse
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
@Override
public BeanDefinition parse(Element element, ParserContext context) {
Object source = context.extractSource(element);
CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), source);
context.pushContainingComponent(compDefinition);
Element channelElem = DomUtils.getChildElementByTagName(element, "client-inbound-channel");
RuntimeBeanReference inChannel = getMessageChannel("clientInboundChannel", channelElem, context, source);
channelElem = DomUtils.getChildElementByTagName(element, "client-outbound-channel");
RuntimeBeanReference outChannel = getMessageChannel("clientOutboundChannel", channelElem, context, source);
channelElem = DomUtils.getChildElementByTagName(element, "broker-channel");
RuntimeBeanReference brokerChannel = getMessageChannel("brokerChannel", channelElem, context, source);
RuntimeBeanReference userRegistry = registerUserRegistry(element, context, source);
Object userDestHandler = registerUserDestHandler(element, userRegistry, inChannel, brokerChannel, context, source);
RuntimeBeanReference converter = registerMessageConverter(element, context, source);
RuntimeBeanReference template = registerMessagingTemplate(element, brokerChannel, converter, context, source);
registerAnnotationMethodMessageHandler(element, inChannel, outChannel,converter, template, context, source);
RootBeanDefinition broker = registerMessageBroker(element, inChannel, outChannel, brokerChannel,
userDestHandler, template, userRegistry, context, source);
// WebSocket and sub-protocol handling
ManagedMap<String, Object> urlMap = registerHandlerMapping(element, context, source);
RuntimeBeanReference stompHandler = registerStompHandler(element, inChannel, outChannel, context, source);
for (Element endpointElem : DomUtils.getChildElementsByTagName(element, "stomp-endpoint")) {
RuntimeBeanReference requestHandler = registerRequestHandler(endpointElem, stompHandler, context, source);
String pathAttribute = endpointElem.getAttribute("path");
Assert.state(StringUtils.hasText(pathAttribute), "Invalid <stomp-endpoint> (no path mapping)");
List<String> paths = Arrays.asList(StringUtils.tokenizeToStringArray(pathAttribute, ","));
for (String path : paths) {
path = path.trim();
Assert.state(StringUtils.hasText(path), "Invalid <stomp-endpoint> path attribute: " + pathAttribute);
if (DomUtils.getChildElementByTagName(endpointElem, "sockjs") != null) {
path = path.endsWith("/") ? path + "**" : path + "/**";
}
urlMap.put(path, requestHandler);
}
}
Map<String, Object> scopeMap = Collections.<String, Object>singletonMap("websocket", new SimpSessionScope());
RootBeanDefinition scopeConfigurer = new RootBeanDefinition(CustomScopeConfigurer.class);
scopeConfigurer.getPropertyValues().add("scopes", scopeMap);
registerBeanDefByName("webSocketScopeConfigurer", scopeConfigurer, context, source);
registerWebSocketMessageBrokerStats(broker, inChannel, outChannel, context, source);
context.popAndRegisterContainingComponent();
return null;
}
示例15: processMapPropertryValueDefinition
import org.springframework.beans.factory.support.ManagedMap; //導入方法依賴的package包/類
protected void processMapPropertryValueDefinition(final String beanName, final String propertyName, final String definitionKey,
final String value, final MutablePropertyValues propertyValues)
{
String key;
String definitionKeyRemainder;
int keySeparator;
if (definitionKey.endsWith(DOT + SUFFIX_PROPERTY_NULL))
{
keySeparator = definitionKey.lastIndexOf(DOT + SUFFIX_PROPERTY_NULL);
}
else if (definitionKey.endsWith(DOT + SUFFIX_PROPERTY_REF))
{
keySeparator = definitionKey.lastIndexOf(DOT + SUFFIX_PROPERTY_REF);
}
else
{
keySeparator = -1;
}
if (keySeparator != -1)
{
key = definitionKey.substring(0, keySeparator);
definitionKeyRemainder = definitionKey.substring(keySeparator + 1);
}
else
{
key = definitionKey;
definitionKeyRemainder = "";
}
final ManagedMap<Object, Object> valueMap = this.initMapPropertyValue(beanName, propertyName, propertyValues);
if (definitionKeyRemainder.equals(SUFFIX_SIMPLE_REMOVE))
{
if (Boolean.parseBoolean(value))
{
valueMap.remove(key);
}
}
else
{
final Object valueToSet = this.getAsValue(beanName, propertyName, definitionKeyRemainder, value);
valueMap.put(key, valueToSet);
}
}