List of usage examples for com.google.common.collect ImmutableMap builder
public static <K, V> Builder<K, V> builder()
From source file:org.jclouds.elasticstack.functions.MapToDriveMetrics.java
public Map<String, ? extends DriveMetrics> apply(Map<String, String> from) { Builder<String, DriveMetrics> builder = ImmutableMap.builder(); addIDEDevices(from, builder);/*from w w w. j av a 2 s.c o m*/ addSCSIDevices(from, builder); addBlockDevices(from, builder); return builder.build(); }
From source file:com.facebook.buck.intellij.ideabuck.ui.tree.renderers.BuckTreeCellRenderer.java
public BuckTreeCellRenderer() { mRenderers = new ImmutableMap.Builder<Class<?>, BuildElementRenderer>() .put(BuckTreeNodeBuild.class, new BuildNodeRenderer()) .put(BuckTreeNodeTarget.class, new TargetNodeRenderer()) .put(BuckTreeNodeFileError.class, new FileErrorNodeRenderer()) .put(BuckTreeNodeDetail.class, new DetailNodeRenderer()) .put(BuckTreeNodeDetailError.class, new DetailNodeRenderer()).build(); }
From source file:com.facebook.buck.apple.xcode.ProjectParser.java
/** * Given a dictionary of {GID: ObjectNSDictionary} pairs and a * builder, writes into the builder the {TargetName: TargetGID} * pairs for all objects of PBXTarget subtype. *//*from www . j av a2 s . c o m*/ public static void extractTargetNameToGIDMap(NSDictionary objects, ImmutableMap.Builder<String, String> targetNamesToGIDs) { for (String gid : objects.allKeys()) { NSObject object = objects.objectForKey(gid); if (!(object instanceof NSDictionary)) { throw new HumanReadableException("Malformed Xcode project (non-dictionary object)"); } NSDictionary objectDict = (NSDictionary) object; NSObject isa = objectDict.objectForKey("isa"); if (!(isa instanceof NSString)) { throw new HumanReadableException("Malformed Xcode project (non-string isa)"); } // No need really to cast here just to call toString(). switch (isa.toString()) { case "PBXNativeTarget": // Fall through. case "PBXAggregateTarget": { NSObject name = objectDict.objectForKey("name"); if (!(name instanceof NSString)) { throw new HumanReadableException("Malformed Xcode project (non-string name)"); } targetNamesToGIDs.put(name.toString(), gid); break; } } } }
From source file:org.hawkular.metrics.api.jaxrs.influx.param.ConvertersProvider.java
public ConvertersProvider() { ImmutableMap.Builder<Class<?>, ParamConverter<?>> paramConvertersBuilder = ImmutableMap.builder(); paramConverters = paramConvertersBuilder.put(InfluxTimeUnit.class, new InfluxTimeUnitConverter()).build(); }
From source file:com.bendb.thrifty.schema.Field.java
Field(FieldElement element, FieldNamingPolicy fieldNamingPolicy) { this.element = element; this.fieldNamingPolicy = fieldNamingPolicy; ImmutableMap.Builder<String, String> annotationBuilder = ImmutableMap.builder(); AnnotationElement anno = element.annotations(); if (anno != null) { annotationBuilder.putAll(anno.values()); }/*from w w w . ja v a 2 s . c o m*/ this.annotations = annotationBuilder.build(); }
From source file:it.tidalwave.northernwind.rca.ui.contenteditor.impl.ResourcePropertiesMatcher.java
@Nonnull public static ResourcePropertiesMatcher resourcePropertiesWith( final @Nonnull ImmutableMap.Builder<Key<String>, String> builder) { return new ResourcePropertiesMatcher(builder.build()); }
From source file:com.google.template.soy.error.SnippetFormatter.java
public SnippetFormatter(List<SoyFileSupplier> suppliers) { ImmutableMap.Builder<String, SoyFileSupplier> builder = new Builder<>(); for (SoyFileSupplier supplier : suppliers) { builder.put(supplier.getFilePath(), supplier); }/*from www. java 2s . c o m*/ filePathsToSuppliers = builder.build(); }
From source file:org.xacml4j.v30.ExpectedAttributeResolverBuilder.java
private ExpectedAttributeResolverBuilder(AttributeResolverDescriptorBuilder b) { this.b = b; this.values = ImmutableMap.builder(); }
From source file:com.google.gxp.compiler.depend.DependencyGraph.java
public DependencyGraph(CompilationSet cSet) { ImmutableMap.Builder<TemplateName.FullyQualified, DependencyNode> mapBuilder = ImmutableMap.builder(); for (CompilationUnit unit : cSet.getCompilationUnits()) { Set<Callable> requirements = getRequirements(unit); TemplateName.FullyQualified name = unit.getTemplateName(); DependencyNode node = new DependencyNode(name, getLastModified(unit), requirements); mapBuilder.put(name, node);//from ww w . ja v a 2 s. c om } this.nodes = mapBuilder.build(); }
From source file:com.facebook.buck.jvm.java.JavacExecutionContextSerializer.java
public static ImmutableMap<String, Object> serialize(JavacExecutionContext context) { ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder(); builder.put(VERBOSITY, context.getVerbosity().toString()); builder.put(CELL_PATH_RESOLVER, CellPathResolverSerializer.serialize(context.getCellPathResolver())); builder.put(JAVA_PACKAGE_FINDER, JavaPackageFinderSerializer.serialize(context.getJavaPackageFinder())); builder.put(PROJECT_FILE_SYSTEM_ROOT, context.getProjectFilesystem().getRootPath().toString()); builder.put(CLASS_USAGE_FILE_WRITER, ClassUsageFileWriterSerializer.serialize(context.getUsedClassesFileWriter())); builder.put(ENVIRONMENT, context.getEnvironment()); builder.put(PROCESS_EXECUTOR, ProcessExecutorSerializer.serialize(context.getProcessExecutor())); builder.put(ABSOLUTE_PATHS_FOR_INPUTS, ImmutableList.copyOf(context.getAbsolutePathsForInputs().stream().map(Path::toString).iterator())); if (context.getDirectToJarOutputSettings().isPresent()) { builder.put(DIRECT_TO_JAR_SETTINGS, DirectToJarOutputSettingsSerializer.serialize(context.getDirectToJarOutputSettings().get())); }//from w ww. j a v a2s . c o m return builder.build(); }