List of usage examples for com.google.common.collect ImmutableMap builder
public static <K, V> Builder<K, V> builder()
From source file:org.apache.beam.runners.dataflow.worker.SinkRegistry.java
/** * A {@link SinkRegistry} with each {@link SinkFactory} known to the Dataflow worker already * registered.//from ww w .j a va 2 s . c o m * * <p>Uses {@link ServiceLoader} to dynamically bind well known types to sink factories via {@link * SinkFactory.Registrar}. */ public static SinkRegistry defaultRegistry() { Set<SinkFactory.Registrar> readerFactoryRegistrars = Sets .newTreeSet(ReflectHelpers.ObjectsClassComparator.INSTANCE); readerFactoryRegistrars.addAll(Lists .newArrayList(ServiceLoader.load(SinkFactory.Registrar.class, ReflectHelpers.findClassLoader()))); ImmutableMap.Builder<String, SinkFactory> factories = ImmutableMap.builder(); for (SinkFactory.Registrar registrar : readerFactoryRegistrars) { factories.putAll(registrar.factories()); } return new SinkRegistry(factories.build()); }
From source file:ru.org.linux.comment.CommentList.java
private static void buildIndex(ImmutableMap.Builder<Integer, CommentNode> builder, CommentNode root) { if (root.getComment() != null) { builder.put(root.getComment().getId(), root); }//w ww .j a va 2 s .co m for (CommentNode child : root.childs()) { buildIndex(builder, child); } }
From source file:com.yfiton.oauth.receiver.PromptReceiver.java
public AuthorizationData requestAuthorizationData(String authorizationUrl, String authorizationCodeParameterName, String... requestParameterNames) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); String authorizationCode = readRequestParameterValue(authorizationCodeParameterName); for (String fieldName : requestParameterNames) { builder.put(fieldName, readRequestParameterValue(fieldName)); }/*from w w w . j a v a 2s . c o m*/ return new AuthorizationData(authorizationCode, builder.build()); }
From source file:com.google.api.tools.framework.aspects.Features.java
public Features(Feature... features) { ImmutableMap.Builder<String, Feature> featuresByNameBuilder = ImmutableMap.builder(); for (Feature feature : features) { feature.addSelfAndChildren(featuresByNameBuilder); }/*from w ww. j ava 2 s . c o m*/ featuresByName = featuresByNameBuilder.build(); }
From source file:io.dropwizard.revolver.exception.TimeoutExceptionMapper.java
@Override public Response toResponse(TimeoutException exception) { return Response.status(Response.Status.GATEWAY_TIMEOUT) .entity(ImmutableMap.builder().put("errorCode", "R000").put("message", "Service timeout").build()) .build();//w ww . j av a 2 s . c o m }
From source file:com.spotify.helios.common.descriptors.ServicePorts.java
private static ServicePorts of(final Iterable<String> ports) { final ImmutableMap.Builder<String, ServicePortParameters> builder = ImmutableMap.builder(); for (final String port : ports) { builder.put(port, new ServicePortParameters(null)); }//from w ww . j a va2s .c o m return new ServicePorts(builder.build()); }
From source file:gobblin.converter.jdbc.JdbcEntryData.java
public JdbcEntryData(Iterable<JdbcEntryDatum> jdbcEntryDatumEntries) { Preconditions.checkNotNull(jdbcEntryDatumEntries); ImmutableMap.Builder<String, JdbcEntryDatum> builder = ImmutableSortedMap.naturalOrder(); for (JdbcEntryDatum datum : jdbcEntryDatumEntries) { builder.put(datum.getColumnName(), datum); }/*w w w .jav a 2 s . co m*/ this.jdbcEntryData = builder.build(); }
From source file:com.jgaap.backend.Canonicizers.java
private static ImmutableMap<String, Canonicizer> loadCanonicizersMap() { // Load the canonicizers dynamically ImmutableMap.Builder<String, Canonicizer> builder = ImmutableMap.builder(); for (Canonicizer canon : CANONICIZERS) { builder.put(canon.displayName().toLowerCase().trim(), canon); }// w w w .j av a 2 s. c o m return builder.build(); }
From source file:kr.co.bitnine.octopus.schema.jdbc.OctopusJdbcSchema.java
public OctopusJdbcSchema(MetaSchema metaSchema, OctopusDataSource dataSource) { super(metaSchema, dataSource); LOG.debug("create OctopusJdbcSchema. schemaName: " + metaSchema.getName()); ImmutableMap.Builder<String, Table> builder = ImmutableMap.builder(); for (MetaTable metaTable : metaSchema.getTables()) builder.put(metaTable.getName(), new OctopusJdbcTable(metaTable, this)); setTableMap(builder.build());/*ww w . j av a 2 s . co m*/ }
From source file:org.sonar.server.computation.sqale.SqaleRatingSettings.java
private static Map<String, LanguageSpecificConfiguration> buildLanguageSpecificConfigurationByLanguageKey( Settings settings) {/*from w w w . j a v a 2 s . c o m*/ ImmutableMap.Builder<String, LanguageSpecificConfiguration> builder = ImmutableMap.builder(); String[] languageConfigIndexes = settings.getStringArray(LANGUAGE_SPECIFIC_PARAMETERS); for (String languageConfigIndex : languageConfigIndexes) { String languagePropertyKey = LANGUAGE_SPECIFIC_PARAMETERS + "." + languageConfigIndex + "." + LANGUAGE_SPECIFIC_PARAMETERS_LANGUAGE_KEY; builder.put(settings.getString(languagePropertyKey), LanguageSpecificConfiguration.create(settings, languageConfigIndex)); } return builder.build(); }