21
21
import org .dataloader .impl .CompletableFutureKit ;
22
22
import org .dataloader .stats .Statistics ;
23
23
import org .dataloader .stats .StatisticsCollector ;
24
+ import org .jspecify .annotations .NullMarked ;
25
+ import org .jspecify .annotations .Nullable ;
24
26
25
27
import java .time .Clock ;
26
28
import java .time .Duration ;
64
66
* @author <a href="https://github.com/bbakerman/">Brad Baker</a>
65
67
*/
66
68
@ PublicApi
69
+ @ NullMarked
67
70
public class DataLoader <K , V > {
68
71
69
72
private final DataLoaderHelper <K , V > helper ;
@@ -99,7 +102,7 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoader<K, V> batchLoadF
99
102
* @deprecated use {@link DataLoaderFactory} instead
100
103
*/
101
104
@ Deprecated
102
- public static <K , V > DataLoader <K , V > newDataLoader (BatchLoader <K , V > batchLoadFunction , DataLoaderOptions options ) {
105
+ public static <K , V > DataLoader <K , V > newDataLoader (BatchLoader <K , V > batchLoadFunction , @ Nullable DataLoaderOptions options ) {
103
106
return DataLoaderFactory .mkDataLoader (batchLoadFunction , options );
104
107
}
105
108
@@ -139,7 +142,7 @@ public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoader<K, Try<V>
139
142
* @deprecated use {@link DataLoaderFactory} instead
140
143
*/
141
144
@ Deprecated
142
- public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoader <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
145
+ public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoader <K , Try <V >> batchLoadFunction , @ Nullable DataLoaderOptions options ) {
143
146
return DataLoaderFactory .mkDataLoader (batchLoadFunction , options );
144
147
}
145
148
@@ -169,7 +172,7 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoaderWithContext<K, V>
169
172
* @deprecated use {@link DataLoaderFactory} instead
170
173
*/
171
174
@ Deprecated
172
- public static <K , V > DataLoader <K , V > newDataLoader (BatchLoaderWithContext <K , V > batchLoadFunction , DataLoaderOptions options ) {
175
+ public static <K , V > DataLoader <K , V > newDataLoader (BatchLoaderWithContext <K , V > batchLoadFunction , @ Nullable DataLoaderOptions options ) {
173
176
return DataLoaderFactory .mkDataLoader (batchLoadFunction , options );
174
177
}
175
178
@@ -209,7 +212,7 @@ public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoaderWithContex
209
212
* @deprecated use {@link DataLoaderFactory} instead
210
213
*/
211
214
@ Deprecated
212
- public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoaderWithContext <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
215
+ public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoaderWithContext <K , Try <V >> batchLoadFunction , @ Nullable DataLoaderOptions options ) {
213
216
return DataLoaderFactory .mkDataLoader (batchLoadFunction , options );
214
217
}
215
218
@@ -239,7 +242,7 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoader<K, V
239
242
* @deprecated use {@link DataLoaderFactory} instead
240
243
*/
241
244
@ Deprecated
242
- public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoader <K , V > batchLoadFunction , DataLoaderOptions options ) {
245
+ public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoader <K , V > batchLoadFunction , @ Nullable DataLoaderOptions options ) {
243
246
return DataLoaderFactory .mkDataLoader (batchLoadFunction , options );
244
247
}
245
248
@@ -280,7 +283,7 @@ public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoad
280
283
* @deprecated use {@link DataLoaderFactory} instead
281
284
*/
282
285
@ Deprecated
283
- public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoader <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
286
+ public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoader <K , Try <V >> batchLoadFunction , @ Nullable DataLoaderOptions options ) {
284
287
return DataLoaderFactory .mkDataLoader (batchLoadFunction , options );
285
288
}
286
289
@@ -310,7 +313,7 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoaderWithC
310
313
* @deprecated use {@link DataLoaderFactory} instead
311
314
*/
312
315
@ Deprecated
313
- public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoaderWithContext <K , V > batchLoadFunction , DataLoaderOptions options ) {
316
+ public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoaderWithContext <K , V > batchLoadFunction , @ Nullable DataLoaderOptions options ) {
314
317
return DataLoaderFactory .mkDataLoader (batchLoadFunction , options );
315
318
}
316
319
@@ -350,7 +353,7 @@ public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoad
350
353
* @deprecated use {@link DataLoaderFactory} instead
351
354
*/
352
355
@ Deprecated
353
- public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoaderWithContext <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
356
+ public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoaderWithContext <K , Try <V >> batchLoadFunction , @ Nullable DataLoaderOptions options ) {
354
357
return DataLoaderFactory .mkDataLoader (batchLoadFunction , options );
355
358
}
356
359
@@ -373,17 +376,17 @@ public DataLoader(BatchLoader<K, V> batchLoadFunction) {
373
376
* @deprecated use {@link DataLoaderFactory} instead
374
377
*/
375
378
@ Deprecated
376
- public DataLoader (BatchLoader <K , V > batchLoadFunction , DataLoaderOptions options ) {
379
+ public DataLoader (BatchLoader <K , V > batchLoadFunction , @ Nullable DataLoaderOptions options ) {
377
380
this ((Object ) batchLoadFunction , options );
378
381
}
379
382
380
383
@ VisibleForTesting
381
- DataLoader (Object batchLoadFunction , DataLoaderOptions options ) {
384
+ DataLoader (Object batchLoadFunction , @ Nullable DataLoaderOptions options ) {
382
385
this (batchLoadFunction , options , Clock .systemUTC ());
383
386
}
384
387
385
388
@ VisibleForTesting
386
- DataLoader (Object batchLoadFunction , DataLoaderOptions options , Clock clock ) {
389
+ DataLoader (Object batchLoadFunction , @ Nullable DataLoaderOptions options , Clock clock ) {
387
390
DataLoaderOptions loaderOptions = options == null ? new DataLoaderOptions () : options ;
388
391
this .futureCache = determineFutureCache (loaderOptions );
389
392
this .valueCache = determineValueCache (loaderOptions );
0 commit comments