/** * @see GinBinder#install(Module) */ protected final void install(GinModule install) { binder.install(install); }
/** * Configures the bound set to silently discard duplicate elements. When multiple equal values are * bound, the one that gets included is arbitrary. When multiple modules contribute elements to * the set, this configuration option impacts all of them. */ public GinMultibinder<T> permitDuplicates() { ginBinder.install(new PermitDuplicatesModule<Provider<T>>(multibindingKey)); return this; }
/** * Configures the {@code MapBinder} to handle duplicate entries. * <p> * When multiple equal keys are bound, the value that gets included in the map is arbitrary. * <p> * In addition to the {@code Map<K, V>} and {@code Map<K, Provider<V>>} maps that are normally * bound, a {@code Map<K, Set<V>>} and {@code Map<K, Set<Provider<V>>>} are <em>also</em> bound, * which contain all values bound to each key. * <p> * When multiple modules contribute elements to the map, this configuration option impacts all of * them. * * @return this map binder */ public GinMapBinder<K, V> permitDuplicates() { ginBinder.install(new PermitDuplicatesModule<MapEntry<K, V>>(multibindingKey)); ginBinder.install(new MultimapModule()); return this; }
public <T> BindingRecorder(GinBinder binder, Key<T> multibindingKey) { BindingRegistererModule<T> module = new BindingRegistererModule<T>(multibindingKey); binder.install(module); this.binder = module.getBinder(); }