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.apache.druid.server.initialization.jetty.CustomExceptionMapper.java

@Override
public Response toResponse(JsonMappingException exception) {
    return Response.status(Response.Status.BAD_REQUEST)
            .entity(ImmutableMap.of("error",
                    exception.getMessage() == null ? "unknown json mapping exception" : exception.getMessage()))
            .build();//from ww  w . j a v a 2  s  .c o  m
}

From source file:org.openqa.selenium.remote.RemoteKeyboard.java

public void sendKeys(CharSequence... keysToSend) {
    executor.execute(DriverCommand.SEND_KEYS_TO_ACTIVE_ELEMENT, ImmutableMap.of("value", keysToSend));
}

From source file:net.floodlightcontroller.perfmon.PerfMonToggleResource.java

@Get
public Object getConfig() {
    IPktInProcessingTimeService pktInProcessingTimeService = (IPktInProcessingTimeService) getContext()
            .getAttributes().get(IPktInProcessingTimeService.class.getCanonicalName());

    return ImmutableMap.of("enabled", pktInProcessingTimeService.isEnabled());

}

From source file:org.openqa.selenium.remote.RenderedRemoteWebElement.java

@SuppressWarnings({ "unchecked" })
public Point getLocation() {
    Response response = parent.execute(DriverCommand.GET_ELEMENT_LOCATION, ImmutableMap.of("id", id));
    Map<String, Object> rawPoint = (Map<String, Object>) response.getValue();
    int x = ((Long) rawPoint.get("x")).intValue();
    int y = ((Long) rawPoint.get("y")).intValue();
    return new Point(x, y);
}

From source file:com.facebook.buck.features.d.DBinaryBuilder.java

private static ToolchainProvider createToolchain(CxxPlatform cxxPlatform) {
    UnresolvedCxxPlatform unresolvedCxxPlatform = new StaticUnresolvedCxxPlatform(cxxPlatform);
    return new ToolchainProviderBuilder()
            .withToolchain(CxxPlatformsProvider.DEFAULT_NAME,
                    CxxPlatformsProvider
                            .of(unresolvedCxxPlatform,
                                    new FlavorDomain<>("C/C++ platform",
                                            ImmutableMap.of(cxxPlatform.getFlavor(), unresolvedCxxPlatform))))
            .build();/* ww  w  .java  2s. c  o  m*/
}

From source file:com.flaptor.indextank.IndexTankTestCase.java

public static Document createDocument(String text) {
    return new Document(ImmutableMap.of("text", text));
}

From source file:io.druid.server.initialization.jetty.ForbiddenExceptionMapper.java

@Override
public Response toResponse(ForbiddenException exception) {
    return Response.status(Response.Status.FORBIDDEN).type(MediaType.APPLICATION_JSON)
            .entity(ImmutableMap.of("Access-Check-Result", exception.getMessage())).build();
}

From source file:org.auraframework.impl.java.controller.JavaTestController.java

@AuraEnabled
public static Object getComponents(@Key("token") String token, @Key("input") String input) throws Exception {
    int count = input == null ? 1 : Integer.parseInt(input);
    List<Component> cmps = new LinkedList<Component>();
    while (count-- > 0) {
        Object val = token + ":java:" + count;
        Map<String, Object> atts = ImmutableMap.of("value", val);
        Component cmp = Aura.getInstanceService().getInstance("auratest:text", ComponentDef.class, atts);
        cmps.add(cmp);//from www.jav a 2s.  c  om
    }
    return cmps.toArray();
}

From source file:org.apache.storm.kafka.StringKeyValueScheme.java

@Override
public List<Object> deserializeKeyAndValue(ByteBuffer key, ByteBuffer value) {
    if (key == null) {
        return deserialize(value);
    }/*from  ww  w  . j  av a2s .com*/
    String keyString = StringScheme.deserializeString(key);
    String valueString = StringScheme.deserializeString(value);
    return new Values(ImmutableMap.of(keyString, valueString));
}

From source file:edu.cmu.lti.oaqa.baseqa.answer.score.scorers.NameCountAnswerScorer.java

@Override
public Map<String, Double> score(JCas jcas, Answer answer) {
    int value = TypeUtil.getCandidateAnswerVariantNames(answer).size();
    return ImmutableMap.of("name-count", (double) value);
}