RxJava2CallAdapterFactory.smali
8.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
.class public final Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;
.super Lretrofit2/CallAdapter$Factory;
.source "RxJava2CallAdapterFactory.java"
# instance fields
.field private final isAsync:Z
.field private final scheduler:Lio/reactivex/Scheduler;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end field
# direct methods
.method private constructor <init>(Lio/reactivex/Scheduler;Z)V
.locals 0
.param p1 # Lio/reactivex/Scheduler;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.line 88
invoke-direct {p0}, Lretrofit2/CallAdapter$Factory;-><init>()V
.line 89
iput-object p1, p0, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->scheduler:Lio/reactivex/Scheduler;
.line 90
iput-boolean p2, p0, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->isAsync:Z
return-void
.end method
.method public static create()Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;
.locals 3
.line 64
new-instance v0, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;
const/4 v1, 0x0
const/4 v2, 0x0
invoke-direct {v0, v1, v2}, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;-><init>(Lio/reactivex/Scheduler;Z)V
return-object v0
.end method
.method public static createAsync()Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;
.locals 3
.line 72
new-instance v0, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;
const/4 v1, 0x0
const/4 v2, 0x1
invoke-direct {v0, v1, v2}, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;-><init>(Lio/reactivex/Scheduler;Z)V
return-object v0
.end method
.method public static createWithScheduler(Lio/reactivex/Scheduler;)Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;
.locals 2
if-eqz p0, :cond_0
.line 82
new-instance v0, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;
const/4 v1, 0x0
invoke-direct {v0, p0, v1}, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;-><init>(Lio/reactivex/Scheduler;Z)V
return-object v0
.line 81
:cond_0
new-instance p0, Ljava/lang/NullPointerException;
const-string v0, "scheduler == null"
invoke-direct {p0, v0}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
throw p0
.end method
# virtual methods
.method public get(Ljava/lang/reflect/Type;[Ljava/lang/annotation/Annotation;Lretrofit2/Retrofit;)Lretrofit2/CallAdapter;
.locals 12
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/reflect/Type;",
"[",
"Ljava/lang/annotation/Annotation;",
"Lretrofit2/Retrofit;",
")",
"Lretrofit2/CallAdapter<",
"**>;"
}
.end annotation
.line 95
invoke-static {p1}, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->getRawType(Ljava/lang/reflect/Type;)Ljava/lang/Class;
move-result-object p2
.line 97
const-class p3, Lio/reactivex/Completable;
if-ne p2, p3, :cond_0
.line 100
new-instance p1, Lretrofit2/adapter/rxjava2/RxJava2CallAdapter;
const-class v1, Ljava/lang/Void;
iget-object v2, p0, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->scheduler:Lio/reactivex/Scheduler;
iget-boolean v3, p0, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->isAsync:Z
const/4 v4, 0x0
const/4 v5, 0x1
const/4 v6, 0x0
const/4 v7, 0x0
const/4 v8, 0x0
const/4 v9, 0x1
move-object v0, p1
invoke-direct/range {v0 .. v9}, Lretrofit2/adapter/rxjava2/RxJava2CallAdapter;-><init>(Ljava/lang/reflect/Type;Lio/reactivex/Scheduler;ZZZZZZZ)V
return-object p1
.line 104
:cond_0
const-class p3, Lio/reactivex/Flowable;
const/4 v0, 0x1
const/4 v1, 0x0
if-ne p2, p3, :cond_1
move v8, v0
goto :goto_0
:cond_1
move v8, v1
.line 105
:goto_0
const-class p3, Lio/reactivex/Single;
if-ne p2, p3, :cond_2
move v9, v0
goto :goto_1
:cond_2
move v9, v1
.line 106
:goto_1
const-class p3, Lio/reactivex/Maybe;
if-ne p2, p3, :cond_3
move v10, v0
goto :goto_2
:cond_3
move v10, v1
.line 107
:goto_2
const-class p3, Lio/reactivex/Observable;
if-eq p2, p3, :cond_4
if-nez v8, :cond_4
if-nez v9, :cond_4
if-nez v10, :cond_4
const/4 p1, 0x0
return-object p1
.line 114
:cond_4
instance-of p2, p1, Ljava/lang/reflect/ParameterizedType;
if-nez p2, :cond_8
if-nez v8, :cond_7
if-nez v9, :cond_6
if-eqz v10, :cond_5
const-string p1, "Maybe"
goto :goto_3
:cond_5
const-string p1, "Observable"
goto :goto_3
:cond_6
const-string p1, "Single"
goto :goto_3
:cond_7
const-string p1, "Flowable"
.line 118
:goto_3
new-instance p2, Ljava/lang/IllegalStateException;
new-instance p3, Ljava/lang/StringBuilder;
invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v0, " return type must be parameterized as "
invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v0, "<Foo> or "
invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string p1, "<? extends Foo>"
invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p2, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p2
.line 122
:cond_8
check-cast p1, Ljava/lang/reflect/ParameterizedType;
invoke-static {v1, p1}, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->getParameterUpperBound(ILjava/lang/reflect/ParameterizedType;)Ljava/lang/reflect/Type;
move-result-object p1
.line 123
invoke-static {p1}, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->getRawType(Ljava/lang/reflect/Type;)Ljava/lang/Class;
move-result-object p2
.line 124
const-class p3, Lretrofit2/Response;
if-ne p2, p3, :cond_a
.line 125
instance-of p2, p1, Ljava/lang/reflect/ParameterizedType;
if-eqz p2, :cond_9
.line 129
check-cast p1, Ljava/lang/reflect/ParameterizedType;
invoke-static {v1, p1}, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->getParameterUpperBound(ILjava/lang/reflect/ParameterizedType;)Ljava/lang/reflect/Type;
move-result-object p1
move-object v3, p1
move v6, v1
move v7, v6
goto :goto_4
.line 126
:cond_9
new-instance p1, Ljava/lang/IllegalStateException;
const-string p2, "Response must be parameterized as Response<Foo> or Response<? extends Foo>"
invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
.line 130
:cond_a
const-class p3, Lretrofit2/adapter/rxjava2/Result;
if-ne p2, p3, :cond_c
.line 131
instance-of p2, p1, Ljava/lang/reflect/ParameterizedType;
if-eqz p2, :cond_b
.line 135
check-cast p1, Ljava/lang/reflect/ParameterizedType;
invoke-static {v1, p1}, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->getParameterUpperBound(ILjava/lang/reflect/ParameterizedType;)Ljava/lang/reflect/Type;
move-result-object p1
move-object v3, p1
move v6, v0
move v7, v1
goto :goto_4
.line 132
:cond_b
new-instance p1, Ljava/lang/IllegalStateException;
const-string p2, "Result must be parameterized as Result<Foo> or Result<? extends Foo>"
invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
:cond_c
move-object v3, p1
move v7, v0
move v6, v1
.line 142
:goto_4
new-instance p1, Lretrofit2/adapter/rxjava2/RxJava2CallAdapter;
iget-object v4, p0, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->scheduler:Lio/reactivex/Scheduler;
iget-boolean v5, p0, Lretrofit2/adapter/rxjava2/RxJava2CallAdapterFactory;->isAsync:Z
const/4 v11, 0x0
move-object v2, p1
invoke-direct/range {v2 .. v11}, Lretrofit2/adapter/rxjava2/RxJava2CallAdapter;-><init>(Ljava/lang/reflect/Type;Lio/reactivex/Scheduler;ZZZZZZZ)V
return-object p1
.end method