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.gradle.model.dsl.internal.inputs.RuleInputAccessBacking.java

public static RuleInputAccess getAccess() {
    final ImmutableMap<String, Object> inputs = INPUT.get();
    return new RuleInputAccess() {
        public Object input(String modelPath) {
            return inputs.get(modelPath);
        }//from  ww w  . j  av a2  s .c o m
    };
}

From source file:net.minecraftforge.client.model.BakedItemModel.java

private static boolean hasGuiIdentity(ImmutableMap<TransformType, TRSRTransformation> transforms) {
    TRSRTransformation guiTransform = transforms.get(TransformType.GUI);
    return guiTransform == null || guiTransform.isIdentity();
}

From source file:com.facebook.buck.apple.toolchain.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.
 *//*from   w  w  w . 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"));
        Objects.requireNonNull(keychainAccessGroups);
        String appID = keychainAccessGroups.objectAtIndex(0).toString();
        return Optional.of(splitAppID(appID).getFirst());
    } catch (RuntimeException e) {
        return Optional.empty();
    }
}

From source file:com.facebook.buck.cxx.AbstractNativeBuildRule.java

private static Collection<String> commandLineArgsForFile(SourcePath file,
        ImmutableMap<SourcePath, String> perSrcFileFlags) {
    String srcFileFlags = perSrcFileFlags.get(file);
    if (srcFileFlags == null) {
        return ImmutableList.of();
    }/*ww  w .  j  a  v a 2  s . c  o  m*/
    // TODO(user): Ugh, this is terrible. We need to pass in an array everywhere, then
    // join it on space for Xcode (which takes a single string of course).
    return ImmutableList.copyOf(srcFileFlags.split(" "));
}

From source file:com.facebook.buck.features.js.JsUtil.java

public static String getValueForFlavor(ImmutableMap<UserFlavor, String> map, Flavor flavor) {
    return Objects.requireNonNull(map.get(flavor), "no string representation of the flavor");
}

From source file:com.facebook.buck.artifact_cache.ArtifactCacheEvent.java

public static final Optional<String> getTarget(final ImmutableMap<String, String> metadata) {
    return metadata.containsKey(TARGET_KEY) ? Optional.of(metadata.get(TARGET_KEY)) : Optional.empty();
}

From source file:com.facebook.watchman.environment.ExecutableFinder.java

private static ImmutableSet<String> getExecutableSuffixes(ImmutableMap<String, String> env) {
    if (Platform.isWindows()) {
        String pathext = env.get("PATHEXT");
        if (pathext == null) {
            return DEFAULT_WINDOWS_EXTENSIONS;
        }/*from   ww  w  .  j  a  v  a  2 s  . c  om*/
        return ImmutableSet.<String>builder().addAll(Splitter.on(";").omitEmptyStrings().split(pathext))
                .build();
    }
    return ImmutableSet.of("");
}

From source file:com.spectralogic.ds3client.helpers.ChunkTransferrer.java

private static Ds3Client getClient(final ImmutableMap<UUID, JobNode> nodeMap, final UUID nodeId,
        final Ds3Client mainClient) {
    final JobNode jobNode = nodeMap.get(nodeId);

    if (jobNode == null) {
        LOG.warn("The jobNode was not found, returning the existing client");
        return mainClient;
    }//www .j  a  va2s  .  c  o m

    return mainClient.newForNode(jobNode);
}

From source file:com.spectralogic.ds3autogen.utils.Ds3TypeClassificationUtil.java

/**
 * Determines if a contract type is an enum defined within the contract
 *///from  w  ww  .  j a  v  a 2 s. c  om
public static boolean isEnumType(final String typeName, final ImmutableMap<String, Ds3Type> typeMap) {
    if (isEmpty(typeName) || isEmpty(typeMap)) {
        return false;
    }
    final Ds3Type type = typeMap.get(typeName);
    return !(type == null || isEmpty(type.getEnumConstants()));
}

From source file:com.google.gerrit.metrics.dropwizard.MetricJson.java

private static Boolean toBool(ImmutableMap<String, String> atts, String key) {
    return Description.TRUE_VALUE.equals(atts.get(key)) ? true : null;
}