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


Java Map.putAll方法代码示例

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


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

示例1: getDataGenerators

import java.util.Map; //导入方法依赖的package包/类
/**
 * Get all data generators applicable to a given path and scope.
 * 
 * @param paths             the audit paths
 * @return                  Returns all data generators mapped to their key-path
 */
public Map<String, DataGenerator> getDataGenerators(Set<String> paths)
{
    Map<String, DataGenerator> amalgamatedGenerators = new HashMap<String, DataGenerator>(13);
    for (String path : paths)
    {
        Map<String, DataGenerator> generators = dataGenerators.get(path);
        if (generators != null)
        {
            // Copy values to combined map
            amalgamatedGenerators.putAll(generators);
        }
    }
    
    // Done
    if (logger.isDebugEnabled())
    {
        logger.debug(
                "Looked up data generators: \n" +
                "   Paths:  " + paths + "\n" +
                "   Found: " + amalgamatedGenerators);
    }
    return amalgamatedGenerators;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:AuditApplication.java

示例2: configure

import java.util.Map; //导入方法依赖的package包/类
@Override
public void configure(Map<String, ?> configs, boolean isKey) {
    Map<String, Object> serializerConfigs = new HashMap<>();
    serializerConfigs.putAll(configs);
    Map<String, Object> deserializerConfigs = new HashMap<>();
    deserializerConfigs.putAll(configs);

    Object encodingValue = configs.get("converter.encoding");
    if (encodingValue != null) {
        serializerConfigs.put("serializer.encoding", encodingValue);
        deserializerConfigs.put("deserializer.encoding", encodingValue);
    }

    serializer.configure(serializerConfigs, isKey);
    deserializer.configure(deserializerConfigs, isKey);
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:17,代码来源:StringConverter.java

示例3: buildProperties

import java.util.Map; //导入方法依赖的package包/类
private Map<String, Property> buildProperties(Model model, Map<String, Property> properties) {

        if (model != null) {
            //some times model can be composed,Composed means if a class inherits another class or interface.
            if (model instanceof ComposedModel) {
                List<Model> allModels = ((ComposedModel) model).getAllOf();
                for (Model eachModel : allModels) {
                    properties.putAll(buildProperties(eachModel, properties));
                }
            } else if (model instanceof RefModel) {
                buildProperties(definitions.get(((RefModel) model).getSimpleRef()), properties);
            } else {
                // in other models such as array,modelImpl,abstract getting properties are straight forward.
                if (model.getProperties() != null) {
                    properties.putAll(model.getProperties());
                }
            }
        }

        return properties;
    }
 
开发者ID:wavemaker,项目名称:wavemaker-app-build-tools,代码行数:22,代码来源:ModelHandler.java

示例4: loadConfigurationProperties

import java.util.Map; //导入方法依赖的package包/类
private Map<String, String> loadConfigurationProperties(
    final String configurationPropertiesPathname, Map<String, String> configurationProperties) {
  configurationProperties =
      (configurationProperties != null ? configurationProperties : new HashMap<String, String>());

  if (IOUtils.isExistingPathname(configurationPropertiesPathname)) {
    try {
      configurationProperties.putAll(ShellCommands
          .loadPropertiesFromURL(new File(configurationPropertiesPathname).toURI().toURL()));
    } catch (MalformedURLException ignore) {
      LogWrapper.getInstance()
          .warning(String.format(
              "Failed to load GemFire configuration properties from pathname (%1$s)!",
              configurationPropertiesPathname), ignore);
    }
  }

  return configurationProperties;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:20,代码来源:LauncherLifecycleCommands.java

示例5: runJavaFix

import java.util.Map; //导入方法依赖的package包/类
private ModificationResult runJavaFix(final JavaFix jf) throws IOException {
    FileObject file = Accessor.INSTANCE.getFile(jf);
    JavaSource js = JavaSource.forFileObject(file);
    final Map<FileObject, List<Difference>> changes = new HashMap<FileObject, List<Difference>>();

    ModificationResult mr = js.runModificationTask(new Task<WorkingCopy>() {
        public void run(WorkingCopy wc) throws Exception {
            if (wc.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0) {
                return;
            }

            Map<FileObject, byte[]> resourceContentChanges = new HashMap<FileObject, byte[]>();
            Accessor.INSTANCE.process(jf, wc, true, resourceContentChanges, /*Ignored for now:*/new ArrayList<RefactoringElementImplementation>());
            BatchUtilities.addResourceContentChanges(resourceContentChanges, changes);
            
        }
    });
    
    changes.putAll(JavaSourceAccessor.getINSTANCE().getDiffsFromModificationResult(mr));
    
    return JavaSourceAccessor.getINSTANCE().createModificationResult(changes, Collections.<Object, int[]>emptyMap());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:HintTest.java

示例6: generateNameToHash

import java.util.Map; //导入方法依赖的package包/类
/**
 * Generates a map of module name to hash value.
 */
static Map<String, byte[]> generateNameToHash(ModuleHashes[] recordedHashes) {
    Map<String, byte[]> nameToHash = null;

    boolean secondSeen = false;
    // record the hashes to build HashSupplier
    for (ModuleHashes mh : recordedHashes) {
        if (mh != null) {
            // if only one module contain ModuleHashes, use it
            if (nameToHash == null) {
                nameToHash = mh.hashes();
            } else {
                if (!secondSeen) {
                    nameToHash = new HashMap<>(nameToHash);
                    secondSeen = true;
                }
                nameToHash.putAll(mh.hashes());
            }
        }
    }
    return (nameToHash != null) ? nameToHash : Collections.emptyMap();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:SystemModuleFinders.java

示例7: getParaObjectFromSource

import java.util.Map; //导入方法依赖的package包/类
/**
 * Converts the source of an ES document to {@link ParaObject}.
 * @param <P> object type
 * @param source a map of keys and values coming from ES
 * @return a new ParaObject
 */
static <P extends ParaObject> P getParaObjectFromSource(Map<String, Object> source) {
	if (source == null) {
		return null;
	}
	Map<String, Object> data = new HashMap<>(source.size());
	data.putAll(source);
	// retrieve the JSON for the original properties field and deserialize it
	if (nestedMode() && data.containsKey(PROPS_JSON)) {
		try {
			Map<String, Object> props = ParaObjectUtils.getJsonReader(Map.class).
					readValue((String) data.get(PROPS_JSON));
			data.put(PROPS_FIELD, props);
		} catch (Exception e) {
			logger.error(null, e);
		}
		data.remove(PROPS_JSON);
	}
	data.remove("_docid");
	return ParaObjectUtils.setAnnotatedFields(data);
}
 
开发者ID:Erudika,项目名称:para-search-elasticsearch,代码行数:27,代码来源:ElasticSearchUtils.java

示例8: getCustomTypes

import java.util.Map; //导入方法依赖的package包/类
/**
 * Use grep to see all the files that contain TypeSerializer, and collect them all
 */
private static Map<String, String> getCustomTypes() throws IOException {
    String line;
    Map<String, String> types = new HashMap<>();
    ProcessBuilder builder = new ProcessBuilder("grep", "-rlP", "extends\\s+TypeSerializer");
    builder.redirectErrorStream(true);
    Process p = builder.start();
    BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));

    // This grep command will output only the file names of the files that contain a TypeSerializer
    while (true) {
        line = r.readLine();
        if (line == null) {
            break;
        }
        // Add all the custom types contained in that file
        types.putAll(getCustomTypes(line));
    }

    return types;
}
 
开发者ID:BenoitDuffez,项目名称:aamg,代码行数:24,代码来源:GenerateAaMigration.java

示例9: addDeserializerToConfig

import java.util.Map; //导入方法依赖的package包/类
public static Map<String, Object> addDeserializerToConfig(Map<String, Object> configs,
                                                          Deserializer<?> keyDeserializer,
                                                          Deserializer<?> valueDeserializer) {
    Map<String, Object> newConfigs = new HashMap<String, Object>();
    newConfigs.putAll(configs);
    if (keyDeserializer != null)
        newConfigs.put(KEY_DESERIALIZER_CLASS_CONFIG, keyDeserializer.getClass());
    if (valueDeserializer != null)
        newConfigs.put(VALUE_DESERIALIZER_CLASS_CONFIG, valueDeserializer.getClass());
    return newConfigs;
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:12,代码来源:ConsumerConfig.java

示例10: getStringStringMap

import java.util.Map; //导入方法依赖的package包/类
private Map<String, String> getStringStringMap(String index) {
    Jedis jedis = getJedis();

    MapStructure<String> mapStructure = RedisStrutureBuilder.ofMap(jedis, String.class).withNameSpace(nameSpace).build();
    Map<String, String> map = mapStructure.get(index);

    Map<String, String> result = new HashMap<>();
    result.putAll(map);
    if (jedis != null) {
        jedis.close();
    }

    return result;
}
 
开发者ID:zerosoft,项目名称:CodeBroker,代码行数:15,代码来源:CacheManager.java

示例11: getFlows

import java.util.Map; //导入方法依赖的package包/类
@Get("json")
@SuppressWarnings("unchecked")
public Map<String, Object> getFlows() {
    Map<String, Object> response = new HashMap<>();
    String switchId = (String) this.getRequestAttributes().get("switch_id");
    logger.debug("Get flows for switch: {}", switchId);
    ISwitchManager switchManager = (ISwitchManager) getContext().getAttributes()
            .get(ISwitchManager.class.getCanonicalName());

    try {
        OFFlowStatsReply replay = switchManager.dumpFlowTable(DatapathId.of(switchId));
        logger.debug("OF_STATS: {}", replay);

        if (replay != null) {
            for (OFFlowStatsEntry entry : replay.getEntries()) {
                String key = String.format("flow-0x%s",
                        Long.toHexString(entry.getCookie().getValue()).toUpperCase());
                response.put(key, buildFlowStat(entry));
            }
        }
    } catch (IllegalArgumentException exception) {
        String messageString = "No such switch";
        logger.error("{}: {}", messageString, switchId, exception);
        MessageError responseMessage = new MessageError(DEFAULT_CORRELATION_ID, System.currentTimeMillis(),
                ErrorType.PARAMETERS_INVALID.toString(), messageString, exception.getMessage());
        response.putAll(MAPPER.convertValue(responseMessage, Map.class));
    }
    return response;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:30,代码来源:FlowsResource.java

示例12: execute

import java.util.Map; //导入方法依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {

    checkConfiguration();

    MetricFilterPublisher publisher =
            dryRun ? new DryRunMetricFilterPublisher(getLog()) :
                    new GenerateMetricFilterPublisher(getLog(),
                            new File(project.getBuild().getDirectory()));

    // Gets a map of fully-namespaced metric names -> annotated fields in classes that extend LambdaMetricSet
    Map<String, Field> metricFields = new HashMap<>();
    try {
        metricFields.putAll(new MetricsFinder(project).find());
    } catch (DependencyResolutionRequiredException | MalformedURLException e) {
        throw new MojoExecutionException("Could not scan classpath for metric fields", e);
    }

    if (!metricFields.isEmpty()) {
        getLog().info(String.format("Found [%d] metric fields in classpath.", metricFields.size()));
        List<MetricFilter> metricFilters = getMetricFilters(metricFields);
        getLog().info(String.format("Published [%d] metric filters.",
                publisher.publishMetricFilters(metricFilters)));
    } else {
        getLog().warn("Did not find any metric fields in classpath.");
    }

}
 
开发者ID:symphoniacloud,项目名称:lambda-monitoring,代码行数:29,代码来源:GenerateMetricFiltersMojo.java

示例13: getAvailableOperations

import java.util.Map; //导入方法依赖的package包/类
@Test
public void getAvailableOperations() {
    // when
    Map<String, String> operations = new HashMap<String, String>();

    operations.putAll(AuditLogOperationGroups.getInstance()
            .getAvailableOperations());

    // then
    assertAvailableOperations(operations);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:12,代码来源:AuditLogOperationGroupsTest.java

示例14: appendJdbcTypeMappingQuery

import java.util.Map; //导入方法依赖的package包/类
static final void appendJdbcTypeMappingQuery(StringBuilder buf, String mysqlTypeColumnName) {

        buf.append("CASE ");
        Map<String, Integer> typesMap = new HashMap<String, Integer>();
        typesMap.putAll(mysqlToJdbcTypesMap);
        typesMap.put("BINARY", Integer.valueOf(Types.BINARY));
        typesMap.put("VARBINARY", Integer.valueOf(Types.VARBINARY));

        Iterator<String> mysqlTypes = typesMap.keySet().iterator();

        while (mysqlTypes.hasNext()) {
            String mysqlTypeName = mysqlTypes.next();
            buf.append(" WHEN ");
            buf.append(mysqlTypeColumnName);
            buf.append("='");
            buf.append(mysqlTypeName);
            buf.append("' THEN ");
            buf.append(typesMap.get(mysqlTypeName));

            if (mysqlTypeName.equalsIgnoreCase("DOUBLE") || mysqlTypeName.equalsIgnoreCase("FLOAT") || mysqlTypeName.equalsIgnoreCase("DECIMAL")
                    || mysqlTypeName.equalsIgnoreCase("NUMERIC")) {
                buf.append(" WHEN ");
                buf.append(mysqlTypeColumnName);
                buf.append("='");
                buf.append(mysqlTypeName);
                buf.append(" unsigned' THEN ");
                buf.append(typesMap.get(mysqlTypeName));
            }
        }

        buf.append(" ELSE ");
        buf.append(Types.OTHER);
        buf.append(" END ");
    }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:MysqlDefs.java

示例15: deserialize

import java.util.Map; //导入方法依赖的package包/类
@Override
public Station deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
    Station station = new Station();
    JsonObject obj = jsonElement.getAsJsonObject();

    Type songCollectionListType = new TypeToken<List<SongCollection>>(){}.getType();
    Type scheduleEntryListType = new TypeToken<List<ScheduleEntry>>(){}.getType();
    Type namedContextConditionsType = new TypeToken<Map<String, ContextCondition>>(){}.getType();
    Type contextListType = new TypeToken<List<ContextEntry>>(){}.getType();

    final Map<String, ContextCondition> namedContextConditions = new HashMap<>();

    station.setName(obj.get("name").getAsString());
    if(obj.has("description"))
        station.setDescription(obj.get("description").getAsString());
    if(obj.has("thumbnail"))
        station.setThumbnail(obj.get("thumbnail").getAsString());
    if(obj.has("collections")){
        List<SongCollection> coll = jsonDeserializationContext.deserialize(obj.get("collections"), songCollectionListType);
        coll.stream().forEach(x -> station.addCollection(x));
    }
    if(obj.has("schedule"))
        station.setSchedule(jsonDeserializationContext.deserialize(obj.get("schedule"), scheduleEntryListType));
    if(obj.has("filters"))
        namedContextConditions.putAll(jsonDeserializationContext.deserialize(obj.get("filters"), namedContextConditionsType));
    if(obj.has("contexts"))
        station.setContexts(jsonDeserializationContext.deserialize(obj.get("contexts"), contextListType));

    for(ContextEntry cont : station.getContexts()) {
        namedContextConditions.putAll(cont.getConditions().getInlinedContextConditions());
    }

    namedContextConditions.keySet().stream().forEach(x -> station.addFilter(x, namedContextConditions.get(x)));

    // Set all necessary parent references
    station.getFilters().values().stream().forEach(x -> x.setStation(station));
    station.getSchedule().stream().forEach(x -> x.setStation(station));
    station.getContexts().stream().forEach(x -> {
        x.setStation(station);
        x.getConditions().setContext(x);
        x.getConditions().getConjunctions().stream().forEach(y -> y.setFormula(x.getConditions()));
    });
    station.getCollections().values().stream().forEach(x -> x.setStation(station));

    return station;
}
 
开发者ID:rumangerst,项目名称:CSLMusicModStationCreator,代码行数:47,代码来源:StationAdapter.java


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