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:com.blacklocus.jres.request.search.query.JresDisMaxQuery.java

public JresDisMaxQuery(List<JresQuery> queries) {
    this.queries = Lists.transform(queries, new Function<JresQuery, Map<String, JresQuery>>() {
        @Override/*from   w ww  .j  a v a  2  s  .  c om*/
        public Map<String, JresQuery> apply(JresQuery input) {
            return ImmutableMap.of(input.queryType(), input);
        }
    });
}

From source file:com.fatboyindustrial.raygun.KeyMaster.java

/**
 * Parse the configuration string and use it as the basis of the key master.
 * @param config The value of {@code <apiKey>}.
 * @return The configured key master instance.
 *//*  w  w w . ja  v  a 2  s. c o m*/
public static KeyMaster fromConfigString(final String config) {
    if (config.indexOf(' ') != -1) {
        return new KeyMaster(parseNamed(config));
    } else {
        return new KeyMaster(ImmutableMap.of(ANY_HOST, config));
    }
}

From source file:net.floodlightcontroller.routing.web.ForceRecomputeResource.java

@Put
@Post//w w  w  . j  ava2  s  .  com
public Map<String, String> forceRecompute() {
    IRoutingService routing = (IRoutingService) getContext().getAttributes()
            .get(IRoutingService.class.getCanonicalName());

    boolean result = routing.forceRecompute();
    log.debug("Force recompute result {}", result);
    return ImmutableMap.of("result", result ? "paths recomputed" : "error recomputing paths");
}

From source file:be.bittich.quote.security.UnauthorizedEntryPoint.java

@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException authException) throws IOException, ServletException {
    String respJSON = jsonifyMap(ImmutableMap.of("error", "Access denied."));
    response.setStatus(401);/*from w  w w .j a v  a2s.com*/
    response.setCharacterEncoding(ENCODING_UTF8);
    response.getWriter().printf(respJSON).flush();
    response.getWriter().close();
}

From source file:tech.beshu.ror.acl.blocks.rules.impl.JwtExternalValidationHttpClient.java

@Override
public CompletableFuture<Boolean> authenticate(String user, String token) {
    return client.send(RRHttpRequest.get(endpoint, ImmutableMap.of("Authorization", "Bearer " + token)))
            .thenApply(response -> response.getStatusCode() == successStatusCode);
}

From source file:be.bittich.quote.security.CustomAccessDeniedHandler.java

@Override
public void handle(HttpServletRequest request, HttpServletResponse response,
        AccessDeniedException accessDeniedException) throws IOException, ServletException {

    String respJSON = jsonifyMap(ImmutableMap.of("error", "Access forbidden."));
    response.setStatus(403);/*from w  w  w.  j a va2 s  . c o m*/
    response.setCharacterEncoding(ENCODING_UTF8);
    response.getWriter().printf(respJSON).flush();
    response.getWriter().close();

}

From source file:co.cask.cdap.data2.queue.QueueEntry.java

public QueueEntry(String hashKey, int hashValue, byte[] data) {
    this(ImmutableMap.of(hashKey, hashValue), data);
}

From source file:us.polygon4.izzymongo.controller.ControllerException.java

public ModelAndView asModelAndView() {
    MappingJacksonJsonView jsonView = new MappingJacksonJsonView();
    return new ModelAndView(jsonView, ImmutableMap.of("error", message));
}

From source file:com.wrmsr.wava.core.literal.Literal.java

@JsonValue
public final Object jsonValue() {
    return ImmutableMap.of(getType().getName(), "0x" + Long.toString(getBits(), 16));
}

From source file:org.sonatype.siesta.webapp.WebappModule.java

@Override
protected void configure() {
    install(new ResteasyModule());
    install(new ValidationModule());

    install(new ServletModule() {
        @Override/*w  w  w.ja v a  2s. c  om*/
        protected void configureServlets() {
            serve("/rest/*").with(SiestaServlet.class,
                    ImmutableMap.of("resteasy.servlet.mapping.prefix", "/rest"));
        }
    });
}