@@ -86,6 +86,7 @@ private DataLoaderOptions(Builder builder) {
86
86
this .environmentProvider = builder .environmentProvider ;
87
87
this .valueCacheOptions = builder .valueCacheOptions ;
88
88
this .batchLoaderScheduler = builder .batchLoaderScheduler ;
89
+ this .instrumentation = builder .instrumentation ;
89
90
}
90
91
91
92
/**
@@ -174,7 +175,7 @@ public boolean batchingEnabled() {
174
175
* Sets the option that determines whether batch loading is enabled.
175
176
*
176
177
* @param batchingEnabled {@code true} to enable batch loading, {@code false} otherwise
177
- * @return the data loader options for fluent coding
178
+ * @return a new data loader options instance for fluent coding
178
179
*/
179
180
public DataLoaderOptions setBatchingEnabled (boolean batchingEnabled ) {
180
181
return builder ().setBatchingEnabled (batchingEnabled ).build ();
@@ -193,7 +194,7 @@ public boolean cachingEnabled() {
193
194
* Sets the option that determines whether caching is enabled.
194
195
*
195
196
* @param cachingEnabled {@code true} to enable caching, {@code false} otherwise
196
- * @return the data loader options for fluent coding
197
+ * @return a new data loader options instance for fluent coding
197
198
*/
198
199
public DataLoaderOptions setCachingEnabled (boolean cachingEnabled ) {
199
200
return builder ().setCachingEnabled (cachingEnabled ).build ();
@@ -217,7 +218,7 @@ public boolean cachingExceptionsEnabled() {
217
218
* Sets the option that determines whether exceptional values are cache enabled.
218
219
*
219
220
* @param cachingExceptionsEnabled {@code true} to enable caching exceptional values, {@code false} otherwise
220
- * @return the data loader options for fluent coding
221
+ * @return a new data loader options instance for fluent coding
221
222
*/
222
223
public DataLoaderOptions setCachingExceptionsEnabled (boolean cachingExceptionsEnabled ) {
223
224
return builder ().setCachingExceptionsEnabled (cachingExceptionsEnabled ).build ();
@@ -238,7 +239,7 @@ public Optional<CacheKey> cacheKeyFunction() {
238
239
* Sets the function to use for creating the cache key, if caching is enabled.
239
240
*
240
241
* @param cacheKeyFunction the cache key function to use
241
- * @return the data loader options for fluent coding
242
+ * @return a new data loader options instance for fluent coding
242
243
*/
243
244
public DataLoaderOptions setCacheKeyFunction (CacheKey <?> cacheKeyFunction ) {
244
245
return builder ().setCacheKeyFunction (cacheKeyFunction ).build ();
@@ -259,7 +260,7 @@ public DataLoaderOptions setCacheKeyFunction(CacheKey<?> cacheKeyFunction) {
259
260
* Sets the cache map implementation to use for caching, if caching is enabled.
260
261
*
261
262
* @param cacheMap the cache map instance
262
- * @return the data loader options for fluent coding
263
+ * @return a new data loader options instance for fluent coding
263
264
*/
264
265
public DataLoaderOptions setCacheMap (CacheMap <?, ?> cacheMap ) {
265
266
return builder ().setCacheMap (cacheMap ).build ();
@@ -280,7 +281,7 @@ public int maxBatchSize() {
280
281
* before they are split into multiple class
281
282
*
282
283
* @param maxBatchSize the maximum batch size
283
- * @return the data loader options for fluent coding
284
+ * @return a new data loader options instance for fluent coding
284
285
*/
285
286
public DataLoaderOptions setMaxBatchSize (int maxBatchSize ) {
286
287
return builder ().setMaxBatchSize (maxBatchSize ).build ();
@@ -299,7 +300,7 @@ public StatisticsCollector getStatisticsCollector() {
299
300
* a common value
300
301
*
301
302
* @param statisticsCollector the statistics collector to use
302
- * @return the data loader options for fluent coding
303
+ * @return a new data loader options instance for fluent coding
303
304
*/
304
305
public DataLoaderOptions setStatisticsCollector (Supplier <StatisticsCollector > statisticsCollector ) {
305
306
return builder ().setStatisticsCollector (nonNull (statisticsCollector )).build ();
@@ -316,7 +317,7 @@ public BatchLoaderContextProvider getBatchLoaderContextProvider() {
316
317
* Sets the batch loader environment provider that will be used to give context to batch load functions
317
318
*
318
319
* @param contextProvider the batch loader context provider
319
- * @return the data loader options for fluent coding
320
+ * @return a new data loader options instance for fluent coding
320
321
*/
321
322
public DataLoaderOptions setBatchLoaderContextProvider (BatchLoaderContextProvider contextProvider ) {
322
323
return builder ().setBatchLoaderContextProvider (nonNull (contextProvider )).build ();
@@ -337,7 +338,7 @@ public DataLoaderOptions setBatchLoaderContextProvider(BatchLoaderContextProvide
337
338
* Sets the value cache implementation to use for caching values, if caching is enabled.
338
339
*
339
340
* @param valueCache the value cache instance
340
- * @return the data loader options for fluent coding
341
+ * @return a new data loader options instance for fluent coding
341
342
*/
342
343
public DataLoaderOptions setValueCache (ValueCache <?, ?> valueCache ) {
343
344
return builder ().setValueCache (valueCache ).build ();
@@ -354,7 +355,7 @@ public ValueCacheOptions getValueCacheOptions() {
354
355
* Sets the {@link ValueCacheOptions} that control how the {@link ValueCache} will be used
355
356
*
356
357
* @param valueCacheOptions the value cache options
357
- * @return the data loader options for fluent coding
358
+ * @return a new data loader options instance for fluent coding
358
359
*/
359
360
public DataLoaderOptions setValueCacheOptions (ValueCacheOptions valueCacheOptions ) {
360
361
return builder ().setValueCacheOptions (nonNull (valueCacheOptions )).build ();
@@ -372,12 +373,29 @@ public BatchLoaderScheduler getBatchLoaderScheduler() {
372
373
* to some future time.
373
374
*
374
375
* @param batchLoaderScheduler the scheduler
375
- * @return the data loader options for fluent coding
376
+ * @return a new data loader options instance for fluent coding
376
377
*/
377
378
public DataLoaderOptions setBatchLoaderScheduler (BatchLoaderScheduler batchLoaderScheduler ) {
378
379
return builder ().setBatchLoaderScheduler (batchLoaderScheduler ).build ();
379
380
}
380
381
382
+ /**
383
+ * @return the {@link DataLoaderInstrumentation} to use
384
+ */
385
+ public DataLoaderInstrumentation getInstrumentation () {
386
+ return instrumentation ;
387
+ }
388
+
389
+ /**
390
+ * Sets in a new {@link DataLoaderInstrumentation}
391
+ *
392
+ * @param instrumentation the new {@link DataLoaderInstrumentation}
393
+ * @return a new data loader options instance for fluent coding
394
+ */
395
+ public DataLoaderOptions setInstrumentation (DataLoaderInstrumentation instrumentation ) {
396
+ return builder ().setInstrumentation (instrumentation ).build ();
397
+ }
398
+
381
399
private Builder builder () {
382
400
return new Builder (this );
383
401
}
@@ -394,6 +412,7 @@ public static class Builder {
394
412
private BatchLoaderContextProvider environmentProvider ;
395
413
private ValueCacheOptions valueCacheOptions ;
396
414
private BatchLoaderScheduler batchLoaderScheduler ;
415
+ private DataLoaderInstrumentation instrumentation ;
397
416
398
417
public Builder () {
399
418
this (new DataLoaderOptions ()); // use the defaults of the DataLoaderOptions for this builder
@@ -411,6 +430,7 @@ public Builder() {
411
430
this .environmentProvider = other .environmentProvider ;
412
431
this .valueCacheOptions = other .valueCacheOptions ;
413
432
this .batchLoaderScheduler = other .batchLoaderScheduler ;
433
+ this .instrumentation = other .instrumentation ;
414
434
}
415
435
416
436
public Builder setBatchingEnabled (boolean batchingEnabled ) {
@@ -468,27 +488,14 @@ public Builder setBatchLoaderScheduler(BatchLoaderScheduler batchLoaderScheduler
468
488
return this ;
469
489
}
470
490
491
+ public Builder setInstrumentation (DataLoaderInstrumentation instrumentation ) {
492
+ this .instrumentation = nonNull (instrumentation );
493
+ return this ;
494
+ }
495
+
471
496
public DataLoaderOptions build () {
472
497
return new DataLoaderOptions (this );
473
498
}
474
499
475
500
}
476
-
477
- /**
478
- * @return the {@link DataLoaderInstrumentation} to use
479
- */
480
- public DataLoaderInstrumentation getInstrumentation () {
481
- return instrumentation ;
482
- }
483
-
484
- /**
485
- * Sets in a new {@link DataLoaderInstrumentation}
486
- *
487
- * @param instrumentation the new {@link DataLoaderInstrumentation}
488
- * @return the data loader options for fluent coding
489
- */
490
- public DataLoaderOptions setInstrumentation (DataLoaderInstrumentation instrumentation ) {
491
- this .instrumentation = nonNull (instrumentation );
492
- return this ;
493
- }
494
501
}
0 commit comments