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.auraframework.component.test.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<>();
    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);/*  w  ww.  j a  va 2 s.co  m*/
    }
    return cmps.toArray();
}

From source file:org.apache.shindig.protocol.DataServiceServletFetcher.java

public Map<String, String> fetch(HttpServletRequest req) {
    return ImmutableMap.of(SecurityTokenCodec.SECURITY_TOKEN_NAME, req.getParameter("st"));
}

From source file:org.openqa.selenium.remote.server.handler.FindActiveElement.java

@Override
public Map<String, String> call() throws Exception {

    WebElement element = getDriver().switchTo().activeElement();
    String elementId = getKnownElements().add(element);
    return ImmutableMap.of("ELEMENT", elementId);
}

From source file:org.openqa.selenium.internal.selenesedriver.GetActiveElement.java

public Map<String, String> apply(Selenium selenium, Map<String, ?> args) {
    String key = selenium.getEval(SCRIPT);
    String locator = "stored=" + urlEncode(key);
    return ImmutableMap.of("ELEMENT", locator);
}

From source file:se.sics.caracaldb.operations.OpUtil.java

/**
 * Puts value if there's no value associated with key currently.
 * /*from w  ww  .  ja v a2s  . c  om*/
 * @param id
 * @param key
 * @param value
 * @return 
 */
public static MultiOpRequest putIfAbsent(UUID id, Key key, byte[] value) {
    Condition c = new EqualCondition(key, null);
    return new MultiOpRequest(id, ImmutableSet.of(c), ImmutableMap.of(key, value),
            ImmutableMap.copyOf(new HashMap<Key, byte[]>())); // see above
}

From source file:com.eviware.loadui.impl.layout.LayoutComponentImpl.java

public LayoutComponentImpl(String constraints) {
    this(ImmutableMap.of(CONSTRAINTS, constraints));
}

From source file:com.google.api.codegen.py.PythonProtoFileInitializer.java

@Override
public ImmutableMap<String, Object> getGlobalMap(ProtoFile file) {
    return ImmutableMap.of("file", (Object) file);
}

From source file:com.google.javascript.refactoring.testing.SuggestedFixes.java

public static void assertChanges(List<SuggestedFix> fixes, String externs, String originalCode,
        String expectedCode) {//from   w  w w . j  ava  2 s  . c  o  m
    assertThat(fixes).isNotEmpty();
    String newCode = ApplySuggestedFixes.applySuggestedFixesToCode(fixes, ImmutableMap.of("test", originalCode))
            .get("test");
    assertEquals(expectedCode, newCode);
}

From source file:org.graylog2.indexer.IndexMapping.java

public Map<String, Object> messageTemplate(final String template, final String analyzer) {
    final Map<String, Object> analyzerKeyword = ImmutableMap.of("analyzer_keyword",
            ImmutableMap.of("tokenizer", "keyword", "filter", "lowercase"));
    final Map<String, Object> analysis = ImmutableMap.of("analyzer", analyzerKeyword);
    final Map<String, Object> settings = ImmutableMap.of("analysis", analysis);
    final Map<String, Object> mappings = ImmutableMap.of(TYPE_MESSAGE, messageMapping(analyzer));

    return ImmutableMap.of("template", template, "settings", settings, "mappings", mappings);
}

From source file:net.conquiris.schema.Schemas.java

/**
 * Creates a new schema with a single item.
 * @param item Schema item.//from  w  w  w.j a  v  a  2  s .c  om
 * @return The created schema.
 * @throws NullPointerException if the argument is {@code null}.
 */
public static Schema of(SchemaItem item) {
    checkNotNull(item, "The schema item must be provided");
    return new SchemaImpl(ImmutableMap.of(item.getName(), item));
}