Skip to content

Commit cabda40

Browse files
authored
Merge pull request #191 from graphql-java/options-breaking-change
Breaking change - renaming old mutable setXX methods
2 parents 182ef06 + bdb1011 commit cabda40

17 files changed

+185
-252
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ for the context object.
205205

206206
```java
207207
DataLoaderOptions options = DataLoaderOptions.newOptions()
208-
.setBatchLoaderContextProvider(() -> SecurityCtx.getCallingUserCtx());
208+
.setBatchLoaderContextProvider(() -> SecurityCtx.getCallingUserCtx()).build();
209209

210210
BatchLoaderWithContext<String, String> batchLoader = new BatchLoaderWithContext<String, String>() {
211211
@Override
@@ -227,7 +227,7 @@ You can gain access to them as a map by key or as the original list of context o
227227

228228
```java
229229
DataLoaderOptions options = DataLoaderOptions.newOptions()
230-
.setBatchLoaderContextProvider(() -> SecurityCtx.getCallingUserCtx());
230+
.setBatchLoaderContextProvider(() -> SecurityCtx.getCallingUserCtx()).build();
231231

232232
BatchLoaderWithContext<String, String> batchLoader = new BatchLoaderWithContext<String, String>() {
233233
@Override
@@ -433,7 +433,7 @@ However, you can create your own custom future cache and supply it to the data l
433433

434434
```java
435435
MyCustomCache customCache = new MyCustomCache();
436-
DataLoaderOptions options = DataLoaderOptions.newOptions().setCacheMap(customCache);
436+
DataLoaderOptions options = DataLoaderOptions.newOptions().setCacheMap(customCache).build();
437437
DataLoaderFactory.newDataLoader(userBatchLoader, options);
438438
```
439439

@@ -467,7 +467,7 @@ The tests have an example based on [Caffeine](https://github.com/ben-manes/caffe
467467
In certain uncommon cases, a DataLoader which does not cache may be desirable.
468468

469469
```java
470-
DataLoaderFactory.newDataLoader(userBatchLoader, DataLoaderOptions.newOptions().setCachingEnabled(false));
470+
DataLoaderFactory.newDataLoader(userBatchLoader, DataLoaderOptions.newOptions().setCachingEnabled(false).build());
471471
```
472472

473473
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
533533
You can configure the statistics collector used when you build the data loader
534534

535535
```java
536-
DataLoaderOptions options = DataLoaderOptions.newOptions().setStatisticsCollector(() -> new ThreadLocalStatisticsCollector());
536+
DataLoaderOptions options = DataLoaderOptions.newOptions().setStatisticsCollector(() -> new ThreadLocalStatisticsCollector()).build();
537537
DataLoader<String,User> userDataLoader = DataLoaderFactory.newDataLoader(userBatchLoader,options);
538538

539539
```
@@ -780,7 +780,7 @@ You set the `DataLoaderInstrumentation` into the `DataLoaderOptions` at build ti
780780
});
781781
}
782782
};
783-
DataLoaderOptions options = DataLoaderOptions.newOptions().setInstrumentation(timingInstrumentation);
783+
DataLoaderOptions options = DataLoaderOptions.newOptions().setInstrumentation(timingInstrumentation).build();
784784
DataLoader<String, User> userDataLoader = DataLoaderFactory.newDataLoader(userBatchLoader, options);
785785

786786
```

src/main/java/org/dataloader/DataLoaderFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ public static <K, V> Builder<K, V> builder(DataLoader<K, V> dataLoader) {
806806
public static class Builder<K, V> {
807807
String name;
808808
Object batchLoadFunction;
809-
DataLoaderOptions options = DataLoaderOptions.newOptions();
809+
DataLoaderOptions options = DataLoaderOptions.newDefaultOptions();
810810

811811
Builder() {
812812
}

0 commit comments

Comments
 (0)