MapBinderBinding<Map<String, Snack>>
Although MapBinders may be injected through a variety of generic types (Map<K, V>,
Map<K, ? extends V>, Map<K, Provider<V>>, Map<K, Set<V>>, Map<K,
Set<Provider<V>>, and even Set<Map.Entry<K, Provider<V>>), a MapBinderBinding exists
only on the Binding associated with the Map<K, V> key. Injectable map types can be
discovered using getMapKey (which will return the Map<K, V> key), orgetAlternateMapKeys (which will return the other keys that can inject this data). Other
bindings can be validated to be derived from this MapBinderBinding using containsElement(Element).
| Modifier and Type | Method and Description |
|---|---|
| public boolean | containsElement(Element element)
Returns true if this MapBinder contains the given Element in order to build the map or uses the given Element in order to support building and injecting the map. |
| public Set | |
| public List | |
| public List | getEntries(Iterable<? extends Element> elements)
Similar to |
| public TypeLiteral | |
| public Key | |
| public TypeLiteral | |
| public boolean |
| containsElement | back to summary |
|---|---|
| public boolean containsElement(Element element) Returns true if this MapBinder contains the given Element in order to build the map or uses the
given Element in order to support building and injecting the map. This will work for
MapBinderBindings retrieved from an injector and If you need to introspect the details of the map, such as the keys, values or if it permits
duplicates, it is necessary to pass the elements through an Injector and use | |
| getAlternateMapKeys | back to summary |
|---|---|
| public Set Returns the keys of other bindings that represent this map. This will return an entry for
| |
| getEntries | back to summary |
|---|---|
| public List Returns all entries in the Map. The returned list of Map.Entries contains the key and a binding
to the value. Duplicate keys or values will exist as separate Map.Entries in the returned list.
This is only supported on bindings returned from an injector. This will throw The elements will always match the type Map's generic type. For example, if getMapKey
returns a key of | |
| getEntries | back to summary |
|---|---|
| public List Similar to One way to use this is to pass in the results of This differs from
| |
| getKeyTypeLiteral | back to summary |
|---|---|
| public TypeLiteral Returns the TypeLiteral describing the keys of the map. The TypeLiteral will always match the type Map's generic type. For example, if getMapKey
returns a key of | |
| getMapKey | back to summary |
|---|---|
| public Key Returns the | |
| getValueTypeLiteral | back to summary |
|---|---|
| public TypeLiteral Returns the TypeLiteral describing the values of the map. The TypeLiteral will always match the type Map's generic type. For example, if getMapKey
returns a key of | |
| permitsDuplicates | back to summary |
|---|---|
| public boolean permitsDuplicates() Returns true if the MapBinder permits duplicates. This is only supported on bindings returned
from an injector. This will throw | |