59
59
* @author <a href="https://github.com/aschrijver/">Arnold Schrijver</a>
60
60
* @author <a href="https://github.com/bbakerman/">Brad Baker</a>
61
61
*/
62
+ @ SuppressWarnings ("UnusedReturnValue" )
62
63
@ PublicApi
63
64
public class DataLoader <K , V > {
64
65
@@ -75,7 +76,10 @@ public class DataLoader<K, V> {
75
76
* @param <V> the value type
76
77
*
77
78
* @return a new DataLoader
79
+ *
80
+ * @deprecated use {@link DataLoaderFactory} instead
78
81
*/
82
+ @ Deprecated
79
83
public static <K , V > DataLoader <K , V > newDataLoader (BatchLoader <K , V > batchLoadFunction ) {
80
84
return newDataLoader (batchLoadFunction , null );
81
85
}
@@ -89,9 +93,12 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoader<K, V> batchLoadF
89
93
* @param <V> the value type
90
94
*
91
95
* @return a new DataLoader
96
+ *
97
+ * @deprecated use {@link DataLoaderFactory} instead
92
98
*/
99
+ @ Deprecated
93
100
public static <K , V > DataLoader <K , V > newDataLoader (BatchLoader <K , V > batchLoadFunction , DataLoaderOptions options ) {
94
- return new DataLoader <> (batchLoadFunction , options );
101
+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
95
102
}
96
103
97
104
/**
@@ -110,7 +117,10 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoader<K, V> batchLoadF
110
117
* @param <V> the value type
111
118
*
112
119
* @return a new DataLoader
120
+ *
121
+ * @deprecated use {@link DataLoaderFactory} instead
113
122
*/
123
+ @ Deprecated
114
124
public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoader <K , Try <V >> batchLoadFunction ) {
115
125
return newDataLoaderWithTry (batchLoadFunction , null );
116
126
}
@@ -127,11 +137,12 @@ public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoader<K, Try<V>
127
137
*
128
138
* @return a new DataLoader
129
139
*
130
- * @see #newDataLoaderWithTry(BatchLoader)
140
+ * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
141
+ * @deprecated use {@link DataLoaderFactory} instead
131
142
*/
132
- @ SuppressWarnings ( "unchecked" )
143
+ @ Deprecated
133
144
public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoader <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
134
- return new DataLoader <>(( BatchLoader < K , V >) batchLoadFunction , options );
145
+ return DataLoaderFactory . mkDataLoader ( batchLoadFunction , options );
135
146
}
136
147
137
148
/**
@@ -143,7 +154,10 @@ public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoader<K, Try<V>
143
154
* @param <V> the value type
144
155
*
145
156
* @return a new DataLoader
157
+ *
158
+ * @deprecated use {@link DataLoaderFactory} instead
146
159
*/
160
+ @ Deprecated
147
161
public static <K , V > DataLoader <K , V > newDataLoader (BatchLoaderWithContext <K , V > batchLoadFunction ) {
148
162
return newDataLoader (batchLoadFunction , null );
149
163
}
@@ -157,9 +171,12 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoaderWithContext<K, V>
157
171
* @param <V> the value type
158
172
*
159
173
* @return a new DataLoader
174
+ *
175
+ * @deprecated use {@link DataLoaderFactory} instead
160
176
*/
177
+ @ Deprecated
161
178
public static <K , V > DataLoader <K , V > newDataLoader (BatchLoaderWithContext <K , V > batchLoadFunction , DataLoaderOptions options ) {
162
- return new DataLoader <> (batchLoadFunction , options );
179
+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
163
180
}
164
181
165
182
/**
@@ -178,7 +195,10 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoaderWithContext<K, V>
178
195
* @param <V> the value type
179
196
*
180
197
* @return a new DataLoader
198
+ *
199
+ * @deprecated use {@link DataLoaderFactory} instead
181
200
*/
201
+ @ Deprecated
182
202
public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoaderWithContext <K , Try <V >> batchLoadFunction ) {
183
203
return newDataLoaderWithTry (batchLoadFunction , null );
184
204
}
@@ -195,10 +215,12 @@ public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoaderWithContex
195
215
*
196
216
* @return a new DataLoader
197
217
*
198
- * @see #newDataLoaderWithTry(BatchLoader)
218
+ * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
219
+ * @deprecated use {@link DataLoaderFactory} instead
199
220
*/
221
+ @ Deprecated
200
222
public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoaderWithContext <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
201
- return new DataLoader <> (batchLoadFunction , options );
223
+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
202
224
}
203
225
204
226
/**
@@ -210,7 +232,10 @@ public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoaderWithContex
210
232
* @param <V> the value type
211
233
*
212
234
* @return a new DataLoader
235
+ *
236
+ * @deprecated use {@link DataLoaderFactory} instead
213
237
*/
238
+ @ Deprecated
214
239
public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoader <K , V > batchLoadFunction ) {
215
240
return newMappedDataLoader (batchLoadFunction , null );
216
241
}
@@ -224,9 +249,12 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoader<K, V
224
249
* @param <V> the value type
225
250
*
226
251
* @return a new DataLoader
252
+ *
253
+ * @deprecated use {@link DataLoaderFactory} instead
227
254
*/
255
+ @ Deprecated
228
256
public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoader <K , V > batchLoadFunction , DataLoaderOptions options ) {
229
- return new DataLoader <> (batchLoadFunction , options );
257
+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
230
258
}
231
259
232
260
/**
@@ -246,7 +274,10 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoader<K, V
246
274
* @param <V> the value type
247
275
*
248
276
* @return a new DataLoader
277
+ *
278
+ * @deprecated use {@link DataLoaderFactory} instead
249
279
*/
280
+ @ Deprecated
250
281
public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoader <K , Try <V >> batchLoadFunction ) {
251
282
return newMappedDataLoaderWithTry (batchLoadFunction , null );
252
283
}
@@ -263,10 +294,12 @@ public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoad
263
294
*
264
295
* @return a new DataLoader
265
296
*
266
- * @see #newDataLoaderWithTry(BatchLoader)
297
+ * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
298
+ * @deprecated use {@link DataLoaderFactory} instead
267
299
*/
300
+ @ Deprecated
268
301
public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoader <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
269
- return new DataLoader <> (batchLoadFunction , options );
302
+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
270
303
}
271
304
272
305
/**
@@ -278,7 +311,10 @@ public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoad
278
311
* @param <V> the value type
279
312
*
280
313
* @return a new DataLoader
314
+ *
315
+ * @deprecated use {@link DataLoaderFactory} instead
281
316
*/
317
+ @ Deprecated
282
318
public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoaderWithContext <K , V > batchLoadFunction ) {
283
319
return newMappedDataLoader (batchLoadFunction , null );
284
320
}
@@ -292,9 +328,12 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoaderWithC
292
328
* @param <V> the value type
293
329
*
294
330
* @return a new DataLoader
331
+ *
332
+ * @deprecated use {@link DataLoaderFactory} instead
295
333
*/
334
+ @ Deprecated
296
335
public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoaderWithContext <K , V > batchLoadFunction , DataLoaderOptions options ) {
297
- return new DataLoader <> (batchLoadFunction , options );
336
+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
298
337
}
299
338
300
339
/**
@@ -313,7 +352,10 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoaderWithC
313
352
* @param <V> the value type
314
353
*
315
354
* @return a new DataLoader
355
+ *
356
+ * @deprecated use {@link DataLoaderFactory} instead
316
357
*/
358
+ @ Deprecated
317
359
public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoaderWithContext <K , Try <V >> batchLoadFunction ) {
318
360
return newMappedDataLoaderWithTry (batchLoadFunction , null );
319
361
}
@@ -330,32 +372,40 @@ public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoad
330
372
*
331
373
* @return a new DataLoader
332
374
*
333
- * @see #newDataLoaderWithTry(BatchLoader)
375
+ * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
376
+ * @deprecated use {@link DataLoaderFactory} instead
334
377
*/
378
+ @ Deprecated
335
379
public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoaderWithContext <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
336
- return new DataLoader <> (batchLoadFunction , options );
380
+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
337
381
}
338
382
339
383
/**
340
384
* Creates a new data loader with the provided batch load function, and default options.
341
385
*
342
386
* @param batchLoadFunction the batch load function to use
387
+ *
388
+ * @deprecated use {@link DataLoaderFactory} instead
343
389
*/
390
+ @ Deprecated
344
391
public DataLoader (BatchLoader <K , V > batchLoadFunction ) {
345
- this (batchLoadFunction , null );
392
+ this (( Object ) batchLoadFunction , null );
346
393
}
347
394
348
395
/**
349
396
* Creates a new data loader with the provided batch load function and options.
350
397
*
351
398
* @param batchLoadFunction the batch load function to use
352
399
* @param options the batch load options
400
+ *
401
+ * @deprecated use {@link DataLoaderFactory} instead
353
402
*/
403
+ @ Deprecated
354
404
public DataLoader (BatchLoader <K , V > batchLoadFunction , DataLoaderOptions options ) {
355
405
this ((Object ) batchLoadFunction , options );
356
406
}
357
407
358
- private DataLoader (Object batchLoadFunction , DataLoaderOptions options ) {
408
+ DataLoader (Object batchLoadFunction , DataLoaderOptions options ) {
359
409
DataLoaderOptions loaderOptions = options == null ? new DataLoaderOptions () : options ;
360
410
this .futureCache = determineCacheMap (loaderOptions );
361
411
// order of keys matter in data loader
0 commit comments