Example usage for java.util Map putAll

List of usage examples for java.util Map putAll

Introduction

In this page you can find the example usage for java.util Map putAll.

Prototype

void putAll(Map<? extends K, ? extends V> m);

Source Link

Document

Copies all of the mappings from the specified map to this map (optional operation).

Usage

From source file:com.google.android.apps.gutenberg.util.CheckInRequest.java

@Override
public Map<String, String> getHeaders() throws AuthFailureError {
    Map<String, String> headers = new HashMap<String, String>();
    headers.putAll(super.getHeaders());
    headers.put("Cookie", mCookie);
    return headers;
}

From source file:com.discovery.darchrow.net.ParamUtil.java

/**
 *  parameter array value map.//from w w w .  ja va 2  s  .  c o  m
 * 
 * <p>
 *  <code>queryString</code> ??,??map,?? <code>arrayValueMap</code>;<br>
 *  {@link LinkedHashMap},??map?
 * </p>
 * 
 * @param uriString
 *            the uri string
 * @param queryString
 *            the query
 * @param arrayValueMap
 *            the name and array value map
 * @param charsetType
 *            ??, {@link CharsetType}<br>
 *            <span style="color:green">null empty,?,?</span><br>
 *            ??,??,ie?chrome? url ,?
 * @return the string
 * @since 1.4.0
 */
private static String addParameterArrayValueMap(String uriString, String queryString,
        Map<String, String[]> arrayValueMap, String charsetType) {
    Map<String, String[]> safeArrayValueMap = ObjectUtils.defaultIfNull(arrayValueMap,
            Collections.<String, String[]>emptyMap());

    Map<String, String[]> arrayParamValuesMap = MapUtil.newLinkedHashMap(safeArrayValueMap.size());
    //???queryString map
    if (Validator.isNotNullOrEmpty(queryString)) {
        arrayParamValuesMap.putAll(toSafeArrayValueMap(queryString, null));
    }
    arrayParamValuesMap.putAll(safeArrayValueMap);
    return combineUrl(URIUtil.getFullPathWithoutQueryString(uriString), arrayParamValuesMap, charsetType);
}

From source file:com.xpfriend.fixture.cast.temp.MapFactory.java

@SuppressWarnings({ "rawtypes", "unchecked" })
private Map toMap(Class<?> cls, DynaBean bean) throws IllegalAccessException, InvocationTargetException,
        NoSuchMethodException, InstantiationException {
    Map map = new DynaBeanMapDecorator(bean, false);
    if (cls.isAssignableFrom(map.getClass())) {
        return map;
    } else {//from   ww  w. j  a v  a 2s  .c  om
        Map obj = (Map) newInstance(cls);
        obj.putAll(map);
        return obj;
    }
}

From source file:com.codecrate.shard.ui.event.commandbus.ApplicationWindowProgressMonitorActionCommandExecutor.java

public void execute(Map params) {
    String description = messageSource.getMessage(messageKey, new Object[] {}, messageKey, Locale.getDefault());
    progressMonitor.taskStarted(description, StatusBar.UNKNOWN);

    try {/*from   w w  w  . j a  v a 2s .  c o m*/
        Map newParams = new HashMap();
        newParams.putAll(params);
        newParams.put("progressMonitor", progressMonitor);
        delegate.execute(newParams);
    } finally {
        progressMonitor.done();
    }
}

From source file:fr.itldev.koya.webscript.global.DiskSize.java

protected Map<String, String> getUrlParamsMap(WebScriptRequest req) {
    Map<String, String> params = new HashMap<>();
    params.putAll(req.getServiceMatch().getTemplateVars());
    for (String k : req.getParameterNames()) {
        params.put(k, req.getParameter(k));
    }//ww w  .  j ava 2 s . co m
    return params;
}

From source file:org.codehaus.griffon.plugins.BasicGriffonPluginInfo.java

public Map getProperties() {
    Map props = new HashMap();
    props.putAll(attributes);
    props.put(NAME, name);// w ww  .  j  ava2 s.co m
    props.put(VERSION, version);
    return props;
}

From source file:net.testdriven.psiprobe.controllers.system.SysInfoController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    SystemInformation systemInformation = new SystemInformation();
    systemInformation.setAppBase(getContainerWrapper().getTomcatContainer().getAppBase().getAbsolutePath());
    systemInformation.setConfigBase(getContainerWrapper().getTomcatContainer().getConfigBase());

    Map sysProps = new Properties();
    sysProps.putAll(System.getProperties());

    if (!SecurityUtils.hasAttributeValueRole(getServletContext(), request)) {
        for (Object filterOutKey : filterOutKeys) {
            sysProps.remove(filterOutKey);
        }/*  w  w  w.  jav  a 2  s . co m*/
    }

    systemInformation.setSystemProperties(sysProps);

    return new ModelAndView(getViewName()).addObject("systemInformation", systemInformation)
            .addObject("runtime", getRuntimeInfoAccessor().getRuntimeInformation())
            .addObject("collectionPeriod", getCollectionPeriod());
}

From source file:com.nextep.designer.headless.helpers.HeadlessHelper.java

/**
 * This helper method extracts command line arguments from the {@link IApplicationContext}
 * element and generates an argument map. This method expects arguments to be in the following
 * format :<br>//from www.j a v  a  2  s  .  c  o  m
 * <code>-<i>option</i>[=<i>value</i>]</code>
 * 
 * @param context the {@link IApplicationContext} of the headless application
 * @return an argument map where the key is the option and value is the option value
 */
public static Map<String, String> processArgs(IApplicationContext context) throws BatchException {
    final Map<?, ?> rawArgsMap = context.getArguments();
    final String[] args = (String[]) rawArgsMap.get(IApplicationContext.APPLICATION_ARGS);
    final Map<String, String> argsMap = new HashMap<String, String>();
    for (String arg : args) {
        String[] splitArg = arg.split("="); //$NON-NLS-1$
        if (splitArg.length > 0) {
            // Accepting arguments starting with a - or not
            String argKey = splitArg[0];
            if (argKey.startsWith("-")) { //$NON-NLS-1$
                argKey = argKey.substring(1);
            }
            // Extracting argument value
            String argValue = null;
            if (splitArg.length > 1) {
                argValue = splitArg[1];
            }
            argsMap.put(argKey, splitArg.length > 1 ? splitArg[1] : null);
            // Processing config file
            if (HeadlessConstants.CONFIG_FILE_ARG.equalsIgnoreCase(argKey)) {
                final Map<String, String> configProps = loadConfigFile(argValue);
                argsMap.putAll(configProps);
            }
        } else {
            LOGGER.warn(MessageFormat.format(HeadlessMessages.getString("application.invalidArgumentWarning"), //$NON-NLS-1$
                    arg));
        }
    }
    return argsMap;
}

From source file:com.googlecode.psiprobe.controllers.system.SysInfoController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    SystemInformation systemInformation = new SystemInformation();
    systemInformation.setAppBase(getContainerWrapper().getTomcatContainer().getAppBase().getAbsolutePath());
    systemInformation.setConfigBase(getContainerWrapper().getTomcatContainer().getConfigBase());

    Map sysProps = new Properties();
    sysProps.putAll(System.getProperties());

    if (!SecurityUtils.hasAttributeValueRole(getServletContext(), request)) {
        for (Iterator it = filterOutKeys.iterator(); it.hasNext();) {
            sysProps.remove(it.next());// www . ja  v a2 s. c o m
        }
    }

    systemInformation.setSystemProperties(sysProps);

    return new ModelAndView(getViewName()).addObject("systemInformation", systemInformation)
            .addObject("runtime", getRuntimeInfoAccessor().getRuntimeInformation())
            .addObject("collectionPeriod", new Long(getCollectionPeriod()));
}

From source file:com.billkoch.examples.hibernate.config.HibernateConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    Map<String, Object> properties = new HashMap<>();
    properties.putAll(jpaProperties.getHibernateProperties(tenantsDataSource()));

    properties.put(Environment.MULTI_TENANT, MultiTenancyStrategy.SCHEMA);
    properties.put(Environment.MULTI_TENANT_CONNECTION_PROVIDER, connectionProvider());
    properties.put(Environment.MULTI_TENANT_IDENTIFIER_RESOLVER, currentTenantIdentifierResolver());

    return builder.dataSource(tenantsDataSource()).packages("com.billkoch.examples").properties(properties)
            .build();//  w  ww  .  j av a  2 s.  c  om
}