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

Method to

java/dagger/internal/codegen/FrameworkType.java:43–71  ·  view source on GitHub ↗
(RequestKind requestKind, CodeBlock from)

Source from the content-addressed store, hash-verified

41 /** A {@link Provider}. */
42 PROVIDER {
43 @Override
44 CodeBlock to(RequestKind requestKind, CodeBlock from) {
45 switch (requestKind) {
46 case INSTANCE:
47 return CodeBlock.of("$L.get()", from);
48
49 case LAZY:
50 return CodeBlock.of("$T.lazy($L)", DoubleCheck.class, from);
51
52 case PROVIDER:
53 return from;
54
55 case PROVIDER_OF_LAZY:
56 return CodeBlock.of("$T.create($L)", ProviderOfLazy.class, from);
57
58 case PRODUCER:
59 return CodeBlock.of("$T.producerFromProvider($L)", Producers.class, from);
60
61 case FUTURE:
62 return CodeBlock.of("$T.immediateFuture($L)", Futures.class, to(INSTANCE, from));
63
64 case PRODUCED:
65 return CodeBlock.of("$T.successful($L)", Produced.class, to(INSTANCE, from));
66
67 default:
68 throw new IllegalArgumentException(
69 String.format("Cannot request a %s from a %s", requestKind, this));
70 }
71 }
72
73 @Override
74 Expression to(RequestKind requestKind, Expression from, DaggerTypes types) {

Callers 15

generateMethod · 0.80
factoryPrefixMethod · 0.80
simpleVariableNameMethod · 0.80
methodNameMethod · 0.80
methodNameMethod · 0.80
creationExpressionMethod · 0.80
visitTypeMethod · 0.80
toStringMethod · 0.80

Calls 11

createMethod · 0.95
codeBlockMethod · 0.80
unwrapTypeOrObjectMethod · 0.80
rewrapTypeMethod · 0.80
wrapTypeMethod · 0.80
getMethod · 0.65
ofMethod · 0.45
formatMethod · 0.45
typeMethod · 0.45
frameworkClassMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected