private static final class RealMapBinder.BindingSelection<K,V>
extends java.lang.Object
It lazily computes the value for keys for various permutations of Maps that are provided by
this module. It also builds up maps from K
to Binding<V>
, which is used by all
of the internal factories to actually provide the desired maps.
During initialization time there is only one BindingSelection. It is possible that multiple
different BindingSelections are constructed. Specifically, in the case of two different modules
each adding bindings to the same MapBinder. If that happens, we define the BindingSelection
held by the RealMapBinder.RealMapProvider
to be the authoritative one. The logic for this exists in
RealMapBinder.RealMultimapBinderProviderWithDependencies
. This is done to avoid confusion because the
BindingSelection contains mutable state.
Modifier and Type | Class and Description |
---|---|
private static class |
RealMapBinder.BindingSelection.InitializationState |
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.ImmutableList<java.util.Map.Entry<K,Binding<V>>> |
entries |
private RealMultibinder<java.util.Map.Entry<K,Provider<V>>> |
entrySetBinder |
private Key<java.util.Set<java.util.Map.Entry<K,javax.inject.Provider<V>>>> |
entrySetJavaxProviderKey |
private RealMapBinder.BindingSelection.InitializationState |
initializationState |
private Key<java.util.Map<K,java.util.Collection<javax.inject.Provider<V>>>> |
javaxProviderCollectionMultimapKey |
private Key<java.util.Map<K,javax.inject.Provider<V>>> |
javaxProviderMapKey |
private Key<java.util.Map<K,java.util.Set<javax.inject.Provider<V>>>> |
javaxProviderSetMultimapKey |
private TypeLiteral<K> |
keyType |
private com.google.common.collect.ImmutableMap<K,Binding<V>> |
mapBindings
These are built during initialization and used by all factories to actually provide the
relevant maps.
|
private Key<java.util.Map<K,V>> |
mapKey |
private Key<java.util.Map<K,? extends V>> |
mapOfKeyExtendsValueKey |
private com.google.common.collect.ImmutableMap<K,java.util.Set<Binding<V>>> |
multimapBindings |
private Key<java.util.Map<K,java.util.Set<V>>> |
multimapKey |
private boolean |
permitsDuplicates
Indicates if this Map permits duplicates.
|
private Key<java.util.Map<K,java.util.Collection<Provider<V>>>> |
providerCollectionMultimapKey |
private Key<java.util.Map<K,Provider<V>>> |
providerMapKey |
private Key<java.util.Map<K,java.util.Set<Provider<V>>>> |
providerSetMultimapKey |
private TypeLiteral<V> |
valueType |
Modifier | Constructor and Description |
---|---|
private |
BindingSelection(TypeLiteral<K> keyType,
TypeLiteral<V> valueType,
Key<java.util.Map<K,V>> mapKey,
RealMultibinder<java.util.Map.Entry<K,Provider<V>>> entrySetBinder) |
Modifier and Type | Method and Description |
---|---|
private boolean |
containsElement(Element element) |
boolean |
equals(java.lang.Object o) |
private com.google.common.collect.ImmutableList<java.util.Map.Entry<K,Binding<V>>> |
getEntries() |
private RealMultibinder<java.util.Map.Entry<K,Provider<V>>> |
getEntrySetBinder() |
private Key<java.util.Set<java.util.Map.Entry<K,javax.inject.Provider<V>>>> |
getEntrySetJavaxProviderKey() |
private Key<java.util.Map<K,java.util.Collection<javax.inject.Provider<V>>>> |
getJavaxProviderCollectionMultimapKey() |
private Key<java.util.Map<K,javax.inject.Provider<V>>> |
getJavaxProviderMapKey() |
private Key<java.util.Map<K,java.util.Set<javax.inject.Provider<V>>>> |
getJavaxProviderSetMultimapKey() |
private TypeLiteral<K> |
getKeyType() |
private com.google.common.collect.ImmutableMap<K,Binding<V>> |
getMapBindings() |
private Key<java.util.Map<K,V>> |
getMapKey() |
private Key<java.util.Map<K,? extends V>> |
getMapOfKeyExtendsValueKey() |
private com.google.common.collect.ImmutableMap<K,java.util.Set<Binding<V>>> |
getMultimapBindings() |
private Key<java.util.Map<K,java.util.Set<V>>> |
getMultimapKey() |
private Key<java.util.Map<K,java.util.Collection<Provider<V>>>> |
getProviderCollectionMultimapKey() |
private Key<java.util.Map<K,Provider<V>>> |
getProviderMapKey() |
private Key<java.util.Map<K,java.util.Set<Provider<V>>>> |
getProviderSetMultimapKey() |
private TypeLiteral<V> |
getValueType() |
int |
hashCode() |
private boolean |
isInitialized() |
private boolean |
matchesValueKey(Key<?> key)
Returns true if the key indicates this is a value in the map.
|
private boolean |
permitsDuplicates() |
private static <K,V> void |
reportDuplicateKeysError(Key<java.util.Map<K,V>> mapKey,
com.google.common.collect.Multimap<K,Binding<V>> duplicates,
Errors errors) |
private boolean |
tryInitialize(InjectorImpl injector,
Errors errors)
Will initialize internal data structures.
|
private final TypeLiteral<K> keyType
private final TypeLiteral<V> valueType
private Key<java.util.Map<K,java.util.Set<Provider<V>>>> providerSetMultimapKey
private Key<java.util.Map<K,java.util.Set<javax.inject.Provider<V>>>> javaxProviderSetMultimapKey
private Key<java.util.Map<K,java.util.Collection<Provider<V>>>> providerCollectionMultimapKey
private Key<java.util.Map<K,java.util.Collection<javax.inject.Provider<V>>>> javaxProviderCollectionMultimapKey
private Key<java.util.Set<java.util.Map.Entry<K,javax.inject.Provider<V>>>> entrySetJavaxProviderKey
private final RealMultibinder<java.util.Map.Entry<K,Provider<V>>> entrySetBinder
private RealMapBinder.BindingSelection.InitializationState initializationState
private com.google.common.collect.ImmutableMap<K,Binding<V>> mapBindings
private com.google.common.collect.ImmutableMap<K,java.util.Set<Binding<V>>> multimapBindings
private boolean permitsDuplicates
private BindingSelection(TypeLiteral<K> keyType, TypeLiteral<V> valueType, Key<java.util.Map<K,V>> mapKey, RealMultibinder<java.util.Map.Entry<K,Provider<V>>> entrySetBinder)
private boolean tryInitialize(InjectorImpl injector, Errors errors)
true
if initialization was successful, false
if there were errorsprivate static <K,V> void reportDuplicateKeysError(Key<java.util.Map<K,V>> mapKey, com.google.common.collect.Multimap<K,Binding<V>> duplicates, Errors errors)
private boolean containsElement(Element element)
private boolean matchesValueKey(Key<?> key)
private Key<java.util.Map<K,javax.inject.Provider<V>>> getJavaxProviderMapKey()
private Key<java.util.Map<K,java.util.Set<Provider<V>>>> getProviderSetMultimapKey()
private Key<java.util.Map<K,java.util.Set<javax.inject.Provider<V>>>> getJavaxProviderSetMultimapKey()
private Key<java.util.Map<K,java.util.Collection<Provider<V>>>> getProviderCollectionMultimapKey()
private Key<java.util.Map<K,java.util.Collection<javax.inject.Provider<V>>>> getJavaxProviderCollectionMultimapKey()
private Key<java.util.Set<java.util.Map.Entry<K,javax.inject.Provider<V>>>> getEntrySetJavaxProviderKey()
private com.google.common.collect.ImmutableMap<K,java.util.Set<Binding<V>>> getMultimapBindings()
private com.google.common.collect.ImmutableList<java.util.Map.Entry<K,Binding<V>>> getEntries()
private boolean isInitialized()
private TypeLiteral<K> getKeyType()
private TypeLiteral<V> getValueType()
private RealMultibinder<java.util.Map.Entry<K,Provider<V>>> getEntrySetBinder()
private boolean permitsDuplicates()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object