Example usage for com.google.common.collect ImmutableMap.Builder putAll

List of usage examples for com.google.common.collect ImmutableMap.Builder putAll

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableMap.Builder putAll.

Prototype

public final void putAll(Map<? extends K, ? extends V> map) 

Source Link

Usage

From source file:org.gradle.api.tasks.scala.AntScalaDoc.java

public void execute(final FileCollection source, final File targetDir, final Iterable<File> classpathFiles,
        Iterable<File> scalaClasspath, final ScalaDocOptions docOptions) {
    antBuilder.withClasspath(scalaClasspath).execute(new Closure<Object>(this) {
        @SuppressWarnings("unused")
        public Object doCall(final AntBuilderDelegate ant) {
            ant.invokeMethod("taskdef", Collections.singletonMap("resource", "scala/tools/ant/antlib.xml"));
            ImmutableMap.Builder<String, Object> optionsBuilder = ImmutableMap.builder();
            optionsBuilder.put("destDir", targetDir);
            optionsBuilder.putAll(docOptions.optionMap());
            ImmutableMap<String, Object> options = optionsBuilder.build();

            return ant.invokeMethod("scaladoc", new Object[] { options, new Closure<Void>(this) {
                public void doCall() {
                    source.addToAntBuilder(ant, "src", FileCollection.AntType.MatchingTask);
                    for (File file : bootclasspathFiles) {
                        ant.invokeMethod("bootclasspath", Collections.singletonMap("location", file));
                    }//  ww w . jav  a  2  s .  co  m
                    for (File dir : extensionDirs) {
                        ant.invokeMethod("extdirs", Collections.singletonMap("location", dir));
                    }
                    for (File file : classpathFiles) {
                        ant.invokeMethod("classpath", Collections.singletonMap("location", file));
                    }
                }
            } });
        }
    });
}

From source file:org.opendaylight.mdsal.dom.broker.ProducerLayout.java

ProducerLayout addChild(final DOMDataTreeProducer producer, final Collection<DOMDataTreeIdentifier> subtrees) {
    final ImmutableMap.Builder<DOMDataTreeIdentifier, DOMDataTreeProducer> cb = ImmutableMap.builder();
    cb.putAll(children);
    for (final DOMDataTreeIdentifier s : subtrees) {
        cb.put(s, producer);/*  w ww . j  a  va  2s.  co m*/
    }

    return new ProducerLayout(shardMap, idToProducer, cb.build());
}

From source file:org.graylog2.dashboards.widgets.StatisticalCountWidget.java

@Override
public Map<String, Object> getPersistedConfig() {
    final Map<String, Object> inheritedConfig = super.getPersistedConfig();
    final ImmutableMap.Builder<String, Object> persistedConfig = ImmutableMap.builder();
    persistedConfig.putAll(inheritedConfig);
    persistedConfig.put("field", field);
    persistedConfig.put("stats_function", statsFunction.toString());
    if (!isNullOrEmpty(streamId)) {
        persistedConfig.put("stream_id", streamId);
    }/* w  w  w .j a  v a2s. c  o m*/

    return persistedConfig.build();
}

From source file:com.facebook.buck.jvm.java.JUnitStep.java

@Override
public ImmutableMap<String, String> getEnvironmentVariables(ExecutionContext context) {
    ImmutableMap.Builder<String, String> env = ImmutableMap.builder();
    env.putAll(this.env);
    env.putAll(nativeLibsEnvironment);/*from   w ww . j av a2s  .c om*/
    return env.build();
}

From source file:com.microsoft.thrifty.schema.Typedef.java

Typedef(TypedefElement element, Map<NamespaceScope, String> namespaces) {
    super(element.newName(), namespaces);
    this.element = element;

    ImmutableMap.Builder<String, String> annotationBuilder = ImmutableMap.builder();
    AnnotationElement anno = element.annotations();
    if (anno != null) {
        annotationBuilder.putAll(anno.values());
    }//  w w  w .  ja  v  a  2 s .c o  m
    this.annotations = annotationBuilder.build();
}

From source file:co.cask.cdap.app.runtime.AbstractProgramRuntimeService.java

/**
 * Return the copy of the {@link ProgramOptions} including RunId in it.
 * @param options The {@link ProgramOptions} in which the RunId to be included
 * @param runId   The RunId to be included
 * @return the copy of the program options with RunId included in them
 *//*from   w  w w  .j ava2s  .c  om*/
private ProgramOptions addRunId(ProgramOptions options, RunId runId) {
    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
    builder.putAll(options.getArguments().asMap());
    builder.put(ProgramOptionConstants.RUN_ID, runId.getId());

    return new SimpleProgramOptions(options.getName(), new BasicArguments(builder.build()),
            options.getUserArguments(), options.isDebug());
}

From source file:com.facebook.buck.rules.coercer.AbstractSourceList.java

public ImmutableMap<String, SourcePath> toNameMap(BuildTarget buildTarget, SourcePathResolver pathResolver,
        String parameterName) {// w w  w . j  a v a2  s .com
    ImmutableMap.Builder<String, SourcePath> sources = ImmutableMap.builder();
    switch (getType()) {
    case NAMED:
        sources.putAll(getNamedSources().get());
        break;
    case UNNAMED:
        sources.putAll(pathResolver.getSourcePathNames(buildTarget, parameterName, getUnnamedSources().get()));
        break;
    }
    return sources.build();
}

From source file:org.elasticsearch.indices.flush.ShardsSyncedFlushResult.java

/**
 * success constructor/*from www.j a  va 2 s. c  o  m*/
 */
public ShardsSyncedFlushResult(ShardId shardId, String syncId, int totalShards,
        Map<ShardRouting, SyncedFlushService.SyncedFlushResponse> shardResponses) {
    this.failureReason = null;
    ImmutableMap.Builder<ShardRouting, SyncedFlushService.SyncedFlushResponse> builder = ImmutableMap.builder();
    this.shardResponses = builder.putAll(shardResponses).build();
    this.syncId = syncId;
    this.totalShards = totalShards;
    this.shardId = shardId;
}

From source file:com.bendb.thrifty.schema.Service.java

Service(ServiceElement element, ThriftType type, Map<NamespaceScope, String> namespaces) {
    super(element.name(), namespaces);
    this.element = element;
    this.type = type;

    ImmutableList.Builder<ServiceMethod> methods = ImmutableList.builder();
    for (FunctionElement functionElement : element.functions()) {
        ServiceMethod method = new ServiceMethod(functionElement);
        methods.add(method);//www . j a v a2s.  c om
    }
    this.methods = methods.build();

    ImmutableMap.Builder<String, String> annotationBuilder = ImmutableMap.builder();
    AnnotationElement anno = element.annotations();
    if (anno != null) {
        annotationBuilder.putAll(anno.values());
    }
    this.annotations = annotationBuilder.build();
}

From source file:org.janusgraph.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter.java

public OrderedKeyValueStoreManagerAdapter(OrderedKeyValueStoreManager manager,
        Map<String, Integer> keyLengths) {
    Preconditions.checkArgument(manager.getFeatures().isKeyOrdered(),
            "Expected backing store to be ordered: %s", manager);
    this.manager = manager;
    ImmutableMap.Builder<String, Integer> mb = ImmutableMap.builder();
    if (keyLengths != null && !keyLengths.isEmpty())
        mb.putAll(keyLengths);
    this.keyLengths = mb.build();
    this.stores = new HashMap<String, OrderedKeyValueStoreAdapter>();
}