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:com.facebook.buck.rules.coercer.VersionMatchedCollection.java

private boolean matches(ImmutableMap<BuildTarget, Version> universe,
        ImmutableMap<BuildTarget, Version> versions) {
    for (Map.Entry<BuildTarget, Version> ent : versions.entrySet()) {
        Version existing = universe.get(ent.getKey());
        if (existing != null && !existing.equals(ent.getValue())) {
            return false;
        }//from w w  w . ja  v  a  2 s.co m
    }
    return true;
}

From source file:com.astonish.dropwizard.routing.db.DAORouter.java

/**
 * Retrieves a type-casted DAO from the {@link DAORouter}.
 * @param daoClass/*from   w ww  . j  a  v a2  s.c o  m*/
 *            the the type of DAO
 * @return the DAO associated with the current route
 */
@SuppressWarnings("unchecked")
public <T> T getDAO(final Class<T> daoClass) {
    checkNotNull(daoClass, "daoClass is required");

    final ImmutableMap<Class<?>, Object> routeDAOs = daosByRoute.get(RouteStore.getInstance().getRoute());
    checkState(null != routeDAOs, "No route found for Route[" + RouteStore.getInstance().getRoute() + "]");
    checkState(null != routeDAOs.get(daoClass), "Unknown DAO[" + daoClass.getSimpleName() + "]");

    return (T) routeDAOs.get(daoClass);
}

From source file:com.android.assetstudiolib.vectordrawable.SvgLeafNode.java

private String getAttributeValues(ImmutableMap<String, String> presentationMap) {
    StringBuilder sb = new StringBuilder("/>\n");
    for (String key : mVdAttributesMap.keySet()) {
        String vectorDrawableAttr = presentationMap.get(key);
        if (!"none".equals(mVdAttributesMap.get(key))) {
            String attr = "\n        " + vectorDrawableAttr + "=\"" + mVdAttributesMap.get(key) + "\"";
            sb.insert(0, attr);//from  w w  w. j ava  2 s  . com
        } else {
            String attr = "\n        " + vectorDrawableAttr + "=\"#00000000\"";
            sb.insert(0, attr);
        }
    }
    return sb.toString();
}

From source file:com.facebook.buck.cli.BuildCommandOptions.java

private void setNumThreadsFromConfig(BuckConfig buckConfig) {
    ImmutableMap<String, String> build = buckConfig.getEntriesForSection("build");
    if (build.containsKey("threads")) {
        try {/*from   w w  w. j  a va2  s.c  om*/
            numThreads = Integer.parseInt(build.get("threads"));
        } catch (NumberFormatException e) {
            throw new HumanReadableException(
                    "Unable to determine number of threads to use from building from buck config file. "
                            + "Value used was '%s'",
                    build.get("threads"));
        }
    }
}

From source file:org.openengsb.core.services.internal.deployer.connector.ConnectorFile.java

public void update(File file) {
    ImmutableMap<String, String> newPropertyMap = readProperties(file);
    domainType = newPropertyMap.get("domainType");
    connectorType = newPropertyMap.get("connectorType");
    attributes = getAttributesFromMap(newPropertyMap);
    properties = getPropertiesFromMap(newPropertyMap);
}

From source file:se.sics.caracaldb.global.SchemaData.java

public String getMetaValue(byte[] id, String key) {
    ImmutableMap<String, String> meta = metaData.get(ByteBuffer.wrap(id));
    if (meta != null) {
        return meta.get(key);
    }//from  w w w.  jav  a2s  . c om
    return null;
}

From source file:com.facebook.buck.rage.VcsInfoCollector.java

public SourceControlInfo gatherScmInformation()
        throws InterruptedException, VersionControlCommandFailedException {
    String currentRevisionId = vcCmdLineInterface.currentRevisionId();
    ImmutableMap<String, String> bookmarksRevisionIds = vcCmdLineInterface
            .bookmarksRevisionsId(TRACKED_BOOKMARKS);
    String baseRevisionId = vcCmdLineInterface.commonAncestor(currentRevisionId,
            bookmarksRevisionIds.get("remote/master"));
    ImmutableSet<String> changedFiles = vcCmdLineInterface.changedFiles(baseRevisionId);

    ImmutableSet.Builder<String> baseBookmarks = ImmutableSet.builder();
    for (Map.Entry<String, String> bookmark : bookmarksRevisionIds.entrySet()) {
        if (bookmark.getValue().startsWith(baseRevisionId)) {
            baseBookmarks.add(bookmark.getKey());
        }/*from  w  w  w .j  ava 2  s . co  m*/
    }

    Optional<String> diff = Optional
            .of(vcCmdLineInterface.diffBetweenRevisions(baseRevisionId, currentRevisionId));

    return SourceControlInfo.builder().setCurrentRevisionId(currentRevisionId)
            .setRevisionIdOffTracked(baseRevisionId).setBasedOffWhichTracked(baseBookmarks.build())
            .setDiff(diff).setDirtyFiles(changedFiles).build();
}

From source file:com.big.data.plan.KafkaSink.java

/**
 * Configure void./*from   w  ww .j a  va2  s  . c  o m*/
 * 
 * @param context
 *            the context
 */
@Override
public void configure(Context context) {
    this.context = context;
    ImmutableMap<String, String> props = context.getParameters();

    parameters = new Properties();
    for (String key : props.keySet()) {
        String value = props.get(key);
        this.parameters.put(key, value);
    }
}

From source file:com.facebook.buck.features.go.GoCompile.java

@Nullable
private ImmutableList<Path> getAsmSources(ImmutableMap<String, ImmutableList<Path>> groupedSrcs) {
    return groupedSrcs.get("s");
}

From source file:com.facebook.buck.features.go.GoCompile.java

@Nullable
private ImmutableList<Path> getGoSources(ImmutableMap<String, ImmutableList<Path>> groupedSrcs) {
    return groupedSrcs.get("go");
}