@@ -205,7 +205,7 @@ for the context object.
205
205
206
206
``` java
207
207
DataLoaderOptions options = DataLoaderOptions . newOptions()
208
- .setBatchLoaderContextProvider(() - > SecurityCtx . getCallingUserCtx());
208
+ .setBatchLoaderContextProvider(() - > SecurityCtx . getCallingUserCtx()) . build( );
209
209
210
210
BatchLoaderWithContext<String , String > batchLoader = new BatchLoaderWithContext<String , String > () {
211
211
@Override
@@ -227,7 +227,7 @@ You can gain access to them as a map by key or as the original list of context o
227
227
228
228
``` java
229
229
DataLoaderOptions options = DataLoaderOptions . newOptions()
230
- .setBatchLoaderContextProvider(() - > SecurityCtx . getCallingUserCtx());
230
+ .setBatchLoaderContextProvider(() - > SecurityCtx . getCallingUserCtx()) . build( );
231
231
232
232
BatchLoaderWithContext<String , String > batchLoader = new BatchLoaderWithContext<String , String > () {
233
233
@Override
@@ -433,7 +433,7 @@ However, you can create your own custom future cache and supply it to the data l
433
433
434
434
``` java
435
435
MyCustomCache customCache = new MyCustomCache ();
436
- DataLoaderOptions options = DataLoaderOptions . newOptions(). setCacheMap(customCache);
436
+ DataLoaderOptions options = DataLoaderOptions . newOptions(). setCacheMap(customCache). build() ;
437
437
DataLoaderFactory . newDataLoader(userBatchLoader, options);
438
438
```
439
439
@@ -467,7 +467,7 @@ The tests have an example based on [Caffeine](https://github.com/ben-manes/caffe
467
467
In certain uncommon cases, a DataLoader which does not cache may be desirable.
468
468
469
469
``` java
470
- DataLoaderFactory . newDataLoader(userBatchLoader, DataLoaderOptions . newOptions(). setCachingEnabled(false ));
470
+ DataLoaderFactory . newDataLoader(userBatchLoader, DataLoaderOptions . newOptions(). setCachingEnabled(false ). build() );
471
471
```
472
472
473
473
Calling the above will ensure that every call to ` .load() ` will produce a new promise, and requested keys will not be saved in memory.
@@ -533,7 +533,7 @@ Knowing what the behaviour of your data is important for you to understand how e
533
533
You can configure the statistics collector used when you build the data loader
534
534
535
535
``` java
536
- DataLoaderOptions options = DataLoaderOptions . newOptions(). setStatisticsCollector(() - > new ThreadLocalStatisticsCollector ());
536
+ DataLoaderOptions options = DataLoaderOptions . newOptions(). setStatisticsCollector(() - > new ThreadLocalStatisticsCollector ()). build() ;
537
537
DataLoader<String ,User > userDataLoader = DataLoaderFactory . newDataLoader(userBatchLoader,options);
538
538
539
539
```
@@ -780,7 +780,7 @@ You set the `DataLoaderInstrumentation` into the `DataLoaderOptions` at build ti
780
780
});
781
781
}
782
782
};
783
- DataLoaderOptions options = DataLoaderOptions . newOptions(). setInstrumentation(timingInstrumentation);
783
+ DataLoaderOptions options = DataLoaderOptions . newOptions(). setInstrumentation(timingInstrumentation). build() ;
784
784
DataLoader<String , User > userDataLoader = DataLoaderFactory . newDataLoader(userBatchLoader, options);
785
785
786
786
```
0 commit comments