(RequestKind requestKind, CodeBlock from)
| 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) { |
no test coverage detected