Example usage for com.google.common.collect ImmutableMap of

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

Introduction

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

Prototype

public static <K, V> ImmutableMap<K, V> of(K k1, V v1) 

Source Link

Usage

From source file:org.rf.ide.core.execution.server.response.InterruptExecution.java

@Override
public String toMessage() {
    try {//from   w  w  w. j  a  v a 2 s.  c  o m
        final List<Object> arguments = new ArrayList<>();
        final Map<String, Object> value = ImmutableMap.of("interrupt", arguments);

        return new ObjectMapper().writeValueAsString(value);
    } catch (final IOException e) {
        throw new ResponseException("Unable to serialize interrupt response arguments to json", e);
    }
}

From source file:org.rf.ide.core.execution.server.response.ContinueExecution.java

@Override
public String toMessage() {
    try {/*from   w  w w.j  a  v a2 s. c o  m*/
        final List<Object> arguments = new ArrayList<>();
        final Map<String, Object> value = ImmutableMap.of("continue", arguments);

        return new ObjectMapper().writeValueAsString(value);
    } catch (final IOException e) {
        throw new ResponseException("Unable to serialize continue response arguments to json", e);
    }
}

From source file:com.facebook.buck.cxx.AbstractCxxBuilder.java

public static FlavorDomain<CxxPlatform> createDefaultPlatforms() {
    CxxPlatform cxxPlatform = CxxPlatformUtils.DEFAULT_PLATFORM;
    return new FlavorDomain<>("C/C++ Platform", ImmutableMap.of(cxxPlatform.getFlavor(), cxxPlatform));
}

From source file:org.rf.ide.core.execution.server.response.ProtocolVersion.java

@Override
public String toMessage() {
    try {//from   w  ww .j  a  v a2s  .  c  om
        final Map<String, Boolean> arguments = ImmutableMap.of("is_correct", Boolean.valueOf(isCorrect));
        final Map<String, Object> value = ImmutableMap.of("protocol_version", arguments);

        return new ObjectMapper().writeValueAsString(value);
    } catch (final IOException e) {
        throw new ResponseException("Unable to serialize protocol version response arguments to json", e);
    }
}

From source file:com.icosilune.fnexample.simple.TimestampFn.java

@Override
public Map<String, FnType> getOutputTypes() {
    return ImmutableMap.of("timestamp", FnType.fromString("double"));
}

From source file:forms.meta.MetaMap.java

/** Returns a MetaMap containing the given mapping. */
public static <T> MetaMap of(MetaField<T> var, T value) {
    return new MetaMap(ImmutableMap.of(var, value));
}

From source file:com.facebook.buck.thrift.ThriftLibraryBuilder.java

public static ThriftLibraryBuilder from(BuildTarget target) {
    ThriftBuckConfig thriftBuckConfig = new ThriftBuckConfig(FakeBuckConfig.builder()
            .setSections(ImmutableMap.of("thrift", ImmutableMap.of("compiler", "/usr/bin/thrift")))
            .setFilesystem(new AllExistingProjectFilesystem()).build());
    PythonLibraryDescription pythonLibraryDescription = new PythonLibraryDescription(
            PythonTestUtils.PYTHON_PLATFORMS);
    return new ThriftLibraryBuilder(new ThriftLibraryDescription(thriftBuckConfig,
            ImmutableList.of(//from  w  w  w .  j  a va 2s  .c o m
                    new ThriftPythonEnhancer(thriftBuckConfig, ThriftPythonEnhancer.Type.ASYNCIO,
                            pythonLibraryDescription),
                    new ThriftPythonEnhancer(thriftBuckConfig, ThriftPythonEnhancer.Type.NORMAL,
                            pythonLibraryDescription),
                    new ThriftPythonEnhancer(thriftBuckConfig, ThriftPythonEnhancer.Type.TWISTED,
                            pythonLibraryDescription))),
            target);
}

From source file:com.facebook.presto.benchmark.BenchmarkQueryRunner.java

public static LocalQueryRunner createLocalQueryRunner(boolean hashingEnabled) {
    SessionBuilder sessionBuilder = testSessionBuilder().setCatalog("tpch").setSchema(TINY_SCHEMA_NAME);

    if (hashingEnabled) {
        sessionBuilder.setSystemProperties(ImmutableMap.of("optimizer.optimize_hash_generation", "true"));
    }//  w  ww . ja  va 2 s  .c  om

    Session session = sessionBuilder.build();
    LocalQueryRunner localQueryRunner = new LocalQueryRunner(session);

    // add tpch
    InMemoryNodeManager nodeManager = localQueryRunner.getNodeManager();
    localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(nodeManager, 1),
            ImmutableMap.<String, String>of());

    return localQueryRunner;
}

From source file:com.yahoo.yqlplus.engine.sources.ListOfMapSource.java

@Query
public List<Map<String, String>> makeObject(String key, Collection<String> values) {
    List<Map<String, String>> objs = new ArrayList<>(values.size());
    for (String value : values) {
        Map<String, String> obj = ImmutableMap.of(key, value);
        objs.add(obj);//from   ww  w  .  j a va2  s . com
    }
    return objs;
}

From source file:com.palantir.atlasdb.table.description.Schemas.java

public static void createIndex(KeyValueService kvs, String fullIndexName, IndexDefinition definition) {
    createIndices(kvs, ImmutableMap.of(fullIndexName, definition));
}