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.jclouds.sqs.xml.IdHandler.java

@Override
public Map.Entry<String, String> apply(String in) {
    return Iterables.getOnlyElement(ImmutableMap.of(in, in).entrySet());
}

From source file:com.mycompany.story.StoryEditor.java

private void initData() throws IOException {
    RestTemplate restTemplate = new RestTemplate();
    Properties properties = new Properties();
    properties.load(new InputStreamReader(getClass().getResourceAsStream("/story.ini")));
    String host = properties.getProperty("host");
    String url = host + "/story";
    restTemplate.getForObject(host, TopicResult.class, ImmutableMap.of("topicId", "1"));
}

From source file:com.lyndir.omicron.api.ResourceCost.java

/**
 * Create a new resource cost initialized by the given amount of resources of the given type.
 *
 * @param resourceType The type of resources to initialize a cost with.
 * @param amount       The amount of resources of the given type.
 *
 * @return A new immutable resource cost instance.
 *///from w  w  w  .  j  a v a 2s .co m
public static ImmutableResourceCost immutableOf(final ResourceType resourceType, final int amount) {
    return new ImmutableResourceCost(ImmutableMap.of(resourceType, amount));
}

From source file:org.sonatype.nexus.quartz.internal.capability.QuartzCapabilitiesBooter.java

@Override
protected void boot(final CapabilityRegistry registry) throws Exception {
    maybeAddCapability(registry, SchedulerCapabilityDescriptor.TYPE, true, null,
            ImmutableMap.of(SchedulerCapabilityConfiguration.ACTIVE,
                    String.valueOf(SchedulerCapabilityConfiguration.DEFAULT_ACTIVE)));
}

From source file:com.nesscomputing.event.jms.JmsEventModule.java

@Override
public void configure() {
    final JmsEventConfig jmsEventConfig = config.getBean(JmsEventConfig.class,
            ImmutableMap.of("jmsName", "jms"));
    bind(JmsEventConfig.class).toInstance(jmsEventConfig);

    if (jmsEventConfig.isEnabled()) {
        install(new JmsModule(config, JMS_EVENT_NAME));

        if (jmsEventConfig.isListenEnabled()) {
            bind(JmsEventReceiver.class).asEagerSingleton();
        }/*w  ww. j a v a 2s . co  m*/
        if (jmsEventConfig.isTransmitEnabled()) {
            bind(JmsEventTransmitter.class).in(Scopes.SINGLETON);
            NessEventModule.bindEventTransmitter(binder(), "jms").to(JmsEventTransmitter.class)
                    .in(Scopes.SINGLETON);
        }
    }
}

From source file:alluxio.ConfigurationRule.java

/**
 * @param key the key of the configuration property to set
 * @param value the value to set it to//from ww w.  j av a 2 s . co m
 */
public ConfigurationRule(PropertyKey key, String value) {
    this(ImmutableMap.of(key, value));
}

From source file:io.appium.java_client.HasDeviceTime.java

/**
 * Gets device date and time for both iOS(host time is returned for simulators) and Android devices.
 *
 * @param format The set of format specifiers. Read
 *               https://momentjs.com/docs/ to get the full list of supported
 *               datetime format specifiers. The default format is
 *               `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601
 * @return Device time string//from   w  w w .  j  a v a 2 s .c  om
 */
default String getDeviceTime(String format) {
    Response response = execute(GET_DEVICE_TIME, ImmutableMap.of("format", format));
    return response.getValue().toString();
}

From source file:org.jclouds.openstack.nova.v2_0.binders.BindMetadataToJsonPayload.java

@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
    return bindToRequest(request, (Object) ImmutableMap.of("metadata",
            ImmutableMap.of(postParams.get("key"), postParams.get("value"))));
}

From source file:com.facebook.buck.halide.HalideLibraryBuilder.java

public static HalideBuckConfig createDefaultHalideConfig(ProjectFilesystem filesystem) throws IOException {
    Path path = Paths.get("fake_compile_script.sh");
    filesystem.touch(path);/*from   w w w.  ja  v a  2  s  .c  om*/
    BuckConfig buckConfig = FakeBuckConfig.builder()
            .setSections(
                    ImmutableMap
                            .of(HalideBuckConfig.HALIDE_SECTION_NAME,
                                    ImmutableMap.of(HalideBuckConfig.HALIDE_XCODE_COMPILE_SCRIPT_KEY,
                                            path.toString(), "target_platform", "halide-target")))
            .setFilesystem(filesystem).build();
    return new HalideBuckConfig(buckConfig);
}

From source file:io.prestosql.plugin.redis.util.CodecSupplier.java

public CodecSupplier(Class<T> clazz, Metadata metadata) {
    this.clazz = clazz;
    ObjectMapperProvider objectMapperProvider = new ObjectMapperProvider();
    objectMapperProvider.setJsonDeserializers(ImmutableMap.of(Type.class, new TypeDeserializer(metadata)));
    this.codecFactory = new JsonCodecFactory(objectMapperProvider);
}