MCPcopy Index your code
hub / github.com/google/dagger / convertToDelegateKey

Method convertToDelegateKey

java/dagger/internal/codegen/KeyFactory.java:332–348  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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>>}.

Callers 2

Calls 10

isMapMethod · 0.95
fromMethod · 0.95
isRawTypeMethod · 0.95
valuesAreTypeOfMethod · 0.95
unwrappedValueTypeMethod · 0.95
mapOfMethod · 0.95
keyTypeMethod · 0.95
buildMethod · 0.65
typeMethod · 0.45
toBuilderMethod · 0.45

Tested by

no test coverage detected