Keys for map contributions from dagger.Provides and dagger.producers.Produces are in the form Map >, but keys for Binds methods are just Map since the framework type is not known until graph resolution. This translates from the {@code @Pro
(Key possibleMapKey)
| 330 | * returns {@code possibleMapKey}. |
| 331 | */ |
| 332 | Key convertToDelegateKey(Key possibleMapKey) { |
| 333 | if (!MapType.isMap(possibleMapKey)) { |
| 334 | return possibleMapKey; |
| 335 | } |
| 336 | MapType mapType = MapType.from(possibleMapKey); |
| 337 | TypeMirror wrappedValueType; |
| 338 | if (mapType.isRawType()) { |
| 339 | return possibleMapKey; |
| 340 | } else if (mapType.valuesAreTypeOf(Provider.class)) { |
| 341 | wrappedValueType = mapType.unwrappedValueType(Provider.class); |
| 342 | } else if (mapType.valuesAreTypeOf(Producer.class)) { |
| 343 | wrappedValueType = mapType.unwrappedValueType(Producer.class); |
| 344 | } else { |
| 345 | return possibleMapKey; |
| 346 | } |
| 347 | return possibleMapKey.toBuilder().type(mapOf(mapType.keyType(), wrappedValueType)).build(); |
| 348 | } |
| 349 | |
| 350 | /** |
| 351 | * Converts a {@link Key} of type {@code Map<K, V>} to {@code Map<K, Provider<V>>}. |
no test coverage detected