Class RealMapBinder.BindingSelection<K,V>
- Enclosing class:
RealMapBinder<K,
V>
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RealMultibinder
<Map.Entry<K, Provider<V>>> private Key
<Map<K, Collection<javax.inject.Provider<V>>>> private final TypeLiteral
<K> These are built during initialization and used by all factories to actually provide the relevant maps.private boolean
Indicates if this Map permits duplicates.private final TypeLiteral
<V> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
BindingSelection
(TypeLiteral<K> keyType, TypeLiteral<V> valueType, Key<Map<K, V>> mapKey, RealMultibinder<Map.Entry<K, Provider<V>>> entrySetBinder) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
containsElement
(Element element) boolean
private RealMultibinder
<Map.Entry<K, Provider<V>>> private Key
<Map<K, Collection<javax.inject.Provider<V>>>> private TypeLiteral
<K> private TypeLiteral
<V> int
hashCode()
private boolean
private boolean
matchesValueKey
(Key<?> key) Returns true if the key indicates this is a value in the map.private boolean
private static <K,
V> void reportDuplicateKeysError
(Key<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.
-
Field Details
-
keyType
-
valueType
-
mapKey
-
javaxProviderMapKey
-
providerMapKey
-
multimapKey
-
providerSetMultimapKey
-
javaxProviderSetMultimapKey
-
providerCollectionMultimapKey
-
javaxProviderCollectionMultimapKey
-
entrySetJavaxProviderKey
-
mapOfKeyExtendsValueKey
-
entrySetBinder
-
initializationState
-
mapBindings
These are built during initialization and used by all factories to actually provide the relevant maps. These contain all of the necessary information about the map binder. -
multimapBindings
-
entries
-
permitsDuplicates
private boolean permitsDuplicatesIndicates if this Map permits duplicates. It is initialized during initialization by querying the injector. This is done because multiple different modules can contribute to a MapBinder, and any one could set permitDuplicates.
-
-
Constructor Details
-
BindingSelection
private BindingSelection(TypeLiteral<K> keyType, TypeLiteral<V> valueType, Key<Map<K, V>> mapKey, RealMultibinder<Map.Entry<K, Provider<V>>> entrySetBinder)
-
-
Method Details
-
tryInitialize
Will initialize internal data structures.- Returns:
true
if initialization was successful,false
if there were errors
-
reportDuplicateKeysError
-
containsElement
-
matchesValueKey
Returns true if the key indicates this is a value in the map. -
getProviderMapKey
-
getJavaxProviderMapKey
-
getMultimapKey
-
getProviderSetMultimapKey
-
getJavaxProviderSetMultimapKey
-
getProviderCollectionMultimapKey
-
getJavaxProviderCollectionMultimapKey
-
getEntrySetJavaxProviderKey
-
getMapOfKeyExtendsValueKey
-
getMapBindings
-
getMultimapBindings
-
getEntries
-
isInitialized
private boolean isInitialized() -
getKeyType
-
getValueType
-
getMapKey
-
getEntrySetBinder
-
permitsDuplicates
private boolean permitsDuplicates() -
equals
-
hashCode
public int hashCode()
-