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

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

Introduction

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

Prototype

V get(Object key);

Source Link

Document

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Usage

From source file:org.apache.calcite.sql.test.SqlTestFactory.java

public static SqlParser.Config createParserConfig(ImmutableMap<String, Object> options) {
    return SqlParser.configBuilder().setQuoting((Quoting) options.get("quoting"))
            .setUnquotedCasing((Casing) options.get("unquotedCasing"))
            .setQuotedCasing((Casing) options.get("quotedCasing"))
            .setConformance((SqlConformance) options.get("conformance"))
            .setCaseSensitive((boolean) options.get("caseSensitive")).build();
}

From source file:com.facebook.buck.apple.AbstractProvisioningProfileMetadata.java

/**
 * Takes an ImmutableMap representing an entitlements file, returns the application prefix
 * if it can be inferred from keys in the entitlement.  Otherwise, it returns empty.
 *//* w ww  .  j  a v a  2  s . co  m*/
public static Optional<String> prefixFromEntitlements(ImmutableMap<String, NSObject> entitlements) {
    try {
        NSArray keychainAccessGroups = ((NSArray) entitlements.get("keychain-access-groups"));
        Preconditions.checkNotNull(keychainAccessGroups);
        String appID = keychainAccessGroups.objectAtIndex(0).toString();
        return Optional.of(splitAppID(appID).getFirst());
    } catch (RuntimeException e) {
        return Optional.empty();
    }
}

From source file:com.spectralogic.ds3client.helpers.strategy.StrategyUtils.java

public static ImmutableCollection<Range> getRangesForBlob(
        final ImmutableMap<String, ImmutableMultimap<BulkObject, Range>> rangesForBlobs,
        final BulkObject blob) {
    final ImmutableMultimap<BulkObject, Range> rangesForBlob = rangesForBlobs.get(blob.getName());

    if (rangesForBlob != null) {
        return rangesForBlob.get(blob);
    }/*from  w  ww. j ava  2  s  . c om*/

    return null;
}

From source file:org.apache.hadoop.yarn.nodelabels.NodeLabelTestBase.java

public static void assertMapContains(Map<NodeId, Set<String>> expected,
        ImmutableMap<NodeId, Set<String>> actual) {
    for (NodeId k : actual.keySet()) {
        Assert.assertTrue(expected.containsKey(k));
        assertCollectionEquals(expected.get(k), actual.get(k));
    }/*ww  w .j  a va2 s. c  o  m*/
}

From source file:com.facebook.buck.remoteexecution.RemoteExecutionConsoleLineProvider.java

private static String getStatesString(ImmutableMap<State, Integer> actionsPerState) {
    List<String> states = Lists.newArrayList();
    for (State state : RemoteExecutionActionEvent.State.values()) {
        String stateName = state.getAbbreviateName();
        int stateValue = actionsPerState.get(state);
        states.add(String.format("%s=%d", stateName, stateValue));
    }/*ww  w.j a v  a2s . c  o m*/

    return Joiner.on(" ").join(states);
}

From source file:com.spectralogic.ds3autogen.python.generators.response.BaseResponseGenerator.java

/**
 * Gets the name to marshal value of the specified type
 *//*from w w w.j  av a  2 s .c o  m*/
protected static String getNameToMarshal(final String typeName, final ImmutableMap<String, Ds3Type> typeMap) {
    if (isEmpty(typeName) || isEmpty(typeMap)) {
        LOG.error("Could not find NameToMarshal because input was empty");
        return null;
    }
    final Ds3Type ds3Type = typeMap.get(typeName);
    if (ds3Type == null || isEmpty(ds3Type.getNameToMarshal())) {
        return null;
    }
    return ds3Type.getNameToMarshal();
}

From source file:org.gradle.internal.component.external.model.LazyToRealisedModuleComponentResolveMetadataHelper.java

private static void populateHierarchy(Configuration metadata,
        ImmutableMap<String, Configuration> configurationDefinitions,
        ImmutableSet.Builder<String> accumulator) {
    accumulator.add(metadata.getName());
    for (String parentName : metadata.getExtendsFrom()) {
        Configuration parent = configurationDefinitions.get(parentName);
        populateHierarchy(parent, configurationDefinitions, accumulator);
    }/*from   w  ww . ja v  a2  s.com*/
}

From source file:com.facebook.buck.dotnet.DotnetFramework.java

private static Path findProgramFiles(FileSystem osFilesystem, ImmutableMap<String, String> env) {
    for (String envName : PROGRAM_FILES_ENV_NAMES) {
        for (String key : env.keySet()) {
            if (envName.equals(key.toLowerCase(US))) {
                String value = env.get(key);
                Path path = osFilesystem.getPath(value);
                if (Files.exists(path)) {
                    return path;
                } else {
                    LOG.info("Found a program files path with %s that did not exist: %s", key, value);
                }//w w  w . j  a va2 s.c o  m
            }
        }
    }

    throw new HumanReadableException("Unable to find ProgramFiles or ProgramFiles(x86) env var");
}

From source file:com.google.caliper.config.CaliperConfig.java

private static ResultProcessorConfig getResultProcessorConfig(ImmutableMap<String, String> resultsProperties,
        String name) {//from  w  ww  .j  a v a  2 s.c o  m
    ImmutableMap<String, String> resultsMap = subgroupMap(resultsProperties, name);
    return new ResultProcessorConfig.Builder().className(resultsMap.get("class"))
            .addAllOptions(subgroupMap(resultsMap, "options")).build();
}

From source file:com.cognifide.aet.runner.conversion.SuiteMergeStrategy.java

private static void mergeTest(Test currentTest, Test patternTest) {
    updateComment(currentTest, patternTest);
    currentTest.setComment(patternTest.getComment());
    final ImmutableMap<String, Url> urlsMap = FluentIterable.from(currentTest.getUrls())
            .uniqueIndex(URL_TO_MAP);

    for (Url patternUrl : patternTest.getUrls()) {
        if (urlsMap.containsKey(patternUrl.getName())) {
            mergeUrl(urlsMap.get(patternUrl.getName()), patternUrl);
        }/*from w  w w.  j av a2 s.co  m*/
    }
}