Skip to content
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ for the context object.

```java
DataLoaderOptions options = DataLoaderOptions.newOptions()
.setBatchLoaderContextProvider(() -> SecurityCtx.getCallingUserCtx());
.setBatchLoaderContextProvider(() -> SecurityCtx.getCallingUserCtx()).build();

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

```java
DataLoaderOptions options = DataLoaderOptions.newOptions()
.setBatchLoaderContextProvider(() -> SecurityCtx.getCallingUserCtx());
.setBatchLoaderContextProvider(() -> SecurityCtx.getCallingUserCtx()).build();

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

```java
MyCustomCache customCache = new MyCustomCache();
DataLoaderOptions options = DataLoaderOptions.newOptions().setCacheMap(customCache);
DataLoaderOptions options = DataLoaderOptions.newOptions().setCacheMap(customCache).build();
DataLoaderFactory.newDataLoader(userBatchLoader, options);
```

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

```java
DataLoaderFactory.newDataLoader(userBatchLoader, DataLoaderOptions.newOptions().setCachingEnabled(false));
DataLoaderFactory.newDataLoader(userBatchLoader, DataLoaderOptions.newOptions().setCachingEnabled(false).build());
```

Calling the above will ensure that every call to `.load()` will produce a new promise, and requested keys will not be saved in memory.
Expand Down Expand Up @@ -533,7 +533,7 @@ Knowing what the behaviour of your data is important for you to understand how e
You can configure the statistics collector used when you build the data loader

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

```
Expand Down Expand Up @@ -780,7 +780,7 @@ You set the `DataLoaderInstrumentation` into the `DataLoaderOptions` at build ti
});
}
};
DataLoaderOptions options = DataLoaderOptions.newOptions().setInstrumentation(timingInstrumentation);
DataLoaderOptions options = DataLoaderOptions.newOptions().setInstrumentation(timingInstrumentation).build();
DataLoader<String, User> userDataLoader = DataLoaderFactory.newDataLoader(userBatchLoader, options);

```
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/dataloader/DataLoaderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ public static <K, V> Builder<K, V> builder(DataLoader<K, V> dataLoader) {
public static class Builder<K, V> {
String name;
Object batchLoadFunction;
DataLoaderOptions options = DataLoaderOptions.newOptions();
DataLoaderOptions options = DataLoaderOptions.newDefaultOptions();

Builder() {
}
Expand Down
Loading