List of usage examples for com.google.common.collect ImmutableMap builder
public static <K, V> Builder<K, V> builder()
From source file:de.ii.ldproxy.service.IndexMappingSubTypeIds.java
@Override public Map<Class<?>, String> getMapping() { return new ImmutableMap.Builder<Class<?>, String>().put(IndexMapping.class, "INDEX").build(); }
From source file:org.apache.sqoop.shell.StopCommand.java
protected StopCommand(Shell shell) { super(shell, Constants.CMD_STOP, Constants.CMD_STOP_SC, new ImmutableMap.Builder<String, Class<? extends SqoopFunction>>() .put(Constants.FN_JOB, StopJobFunction.class).build()); }
From source file:com.facebook.buck.swift.toolchain.impl.SwiftPlatformsProviderFactory.java
private static FlavorDomain<SwiftPlatform> createSwiftPlatforms( AppleCxxPlatformsProvider appleCxxPlatformsProvider) { FlavorDomain<AppleCxxPlatform> appleCxxPlatforms = appleCxxPlatformsProvider.getAppleCxxPlatforms(); ImmutableMap.Builder<Flavor, SwiftPlatform> swiftPlatforms = ImmutableMap.builder(); for (Flavor flavor : appleCxxPlatforms.getFlavors()) { appleCxxPlatforms.getValue(flavor).getSwiftPlatform() .ifPresent(swiftPlatform -> swiftPlatforms.put(flavor, swiftPlatform)); }/*from w w w. j av a 2 s .c o m*/ return new FlavorDomain<>("Swift Platform", swiftPlatforms.build()); }
From source file:de.ii.ldproxy.output.jsonld.JsonLdMappingSubTypeIds.java
@Override public Map<Class<?>, String> getMapping() { return new ImmutableMap.Builder<Class<?>, String>().put(WktGeometryMapping.class, "WKT_GEOMETRY").build(); }
From source file:org.apache.james.util.streams.ImmutableCollectors.java
public static <T, K, V> Collector<T, ImmutableMap.Builder<K, V>, ImmutableMap<K, V>> toImmutableMap( Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper) { return Collector.of(ImmutableMap::<K, V>builder, (acc, v) -> acc.put(keyMapper.apply(v), valueMapper.apply(v)), (map1, map2) -> map1.putAll(map2.build()), ImmutableMap.Builder::build); }
From source file:org.apache.sqoop.shell.StartCommand.java
protected StartCommand(Shell shell) { super(shell, Constants.CMD_START, Constants.CMD_START_SC, new ImmutableMap.Builder<String, Class<? extends SqoopFunction>>() .put(Constants.FN_JOB, StartJobFunction.class).build()); }
From source file:com.google.devtools.build.lib.skylarkbuildapi.Bootstrap.java
/** * Adds this bootstrap's bindings to the given environment map builder. */ public void addBindingsToBuilder(ImmutableMap.Builder<String, Object> builder);
From source file:de.ii.ldproxy.output.html.MicrodataMappingSubTypeIds.java
@Override public Map<Class<?>, String> getMapping() { return new ImmutableMap.Builder<Class<?>, String>() .put(MicrodataPropertyMapping.class, "MICRODATA_PROPERTY") .put(MicrodataGeometryMapping.class, "MICRODATA_GEOMETRY").build(); }
From source file:org.apache.sqoop.shell.StatusCommand.java
protected StatusCommand(Shell shell) { super(shell, Constants.CMD_STATUS, Constants.CMD_STATUS_SC, new ImmutableMap.Builder<String, Class<? extends SqoopFunction>>() .put(Constants.FN_JOB, ShowJobStatusFunction.class).build()); }
From source file:com.quavo.osrs.network.handler.NetworkMessageRepository.java
/** * Builds the network listeners for this repository. * //from w ww .jav a 2 s. c o m * @return The created {@link ImmutableMap} of network listeners. */ private static ImmutableMap<Class<?>, NetworkMessageListener<NetworkMessage>> buildNetworkListeners() { final ImmutableMap.Builder<Class<?>, NetworkMessageListener<NetworkMessage>> builder = ImmutableMap .builder(); try { Class<?>[] classes = FileUtilities.getAllClasses(Constants.PRESENTATION + ".network.handler.listener"); for (Class<?> clazz : classes) { Preconditions.checkNotNull(clazz, "Listener class is not usable.");// returns type too. Class<?> message = Class.forName(clazz.getGenericInterfaces()[0].toString() .replace(Constants.PRESENTATION + ".network.handler.NetworkMessageListener<", "") .replace(">", "")); // this is a safe cast. builder.put(message, (NetworkMessageListener<NetworkMessage>) clazz.newInstance()); } } catch (Exception e) { e.printStackTrace(); } return builder.build(); }