@@ -86,6 +86,7 @@ private DataLoaderOptions(Builder builder) {
8686 this .environmentProvider = builder .environmentProvider ;
8787 this .valueCacheOptions = builder .valueCacheOptions ;
8888 this .batchLoaderScheduler = builder .batchLoaderScheduler ;
89+ this .instrumentation = builder .instrumentation ;
8990 }
9091
9192 /**
@@ -174,7 +175,7 @@ public boolean batchingEnabled() {
174175 * Sets the option that determines whether batch loading is enabled.
175176 *
176177 * @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
178179 */
179180 public DataLoaderOptions setBatchingEnabled (boolean batchingEnabled ) {
180181 return builder ().setBatchingEnabled (batchingEnabled ).build ();
@@ -193,7 +194,7 @@ public boolean cachingEnabled() {
193194 * Sets the option that determines whether caching is enabled.
194195 *
195196 * @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
197198 */
198199 public DataLoaderOptions setCachingEnabled (boolean cachingEnabled ) {
199200 return builder ().setCachingEnabled (cachingEnabled ).build ();
@@ -217,7 +218,7 @@ public boolean cachingExceptionsEnabled() {
217218 * Sets the option that determines whether exceptional values are cache enabled.
218219 *
219220 * @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
221222 */
222223 public DataLoaderOptions setCachingExceptionsEnabled (boolean cachingExceptionsEnabled ) {
223224 return builder ().setCachingExceptionsEnabled (cachingExceptionsEnabled ).build ();
@@ -238,7 +239,7 @@ public Optional<CacheKey> cacheKeyFunction() {
238239 * Sets the function to use for creating the cache key, if caching is enabled.
239240 *
240241 * @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
242243 */
243244 public DataLoaderOptions setCacheKeyFunction (CacheKey <?> cacheKeyFunction ) {
244245 return builder ().setCacheKeyFunction (cacheKeyFunction ).build ();
@@ -259,7 +260,7 @@ public DataLoaderOptions setCacheKeyFunction(CacheKey<?> cacheKeyFunction) {
259260 * Sets the cache map implementation to use for caching, if caching is enabled.
260261 *
261262 * @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
263264 */
264265 public DataLoaderOptions setCacheMap (CacheMap <?, ?> cacheMap ) {
265266 return builder ().setCacheMap (cacheMap ).build ();
@@ -280,7 +281,7 @@ public int maxBatchSize() {
280281 * before they are split into multiple class
281282 *
282283 * @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
284285 */
285286 public DataLoaderOptions setMaxBatchSize (int maxBatchSize ) {
286287 return builder ().setMaxBatchSize (maxBatchSize ).build ();
@@ -299,7 +300,7 @@ public StatisticsCollector getStatisticsCollector() {
299300 * a common value
300301 *
301302 * @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
303304 */
304305 public DataLoaderOptions setStatisticsCollector (Supplier <StatisticsCollector > statisticsCollector ) {
305306 return builder ().setStatisticsCollector (nonNull (statisticsCollector )).build ();
@@ -316,7 +317,7 @@ public BatchLoaderContextProvider getBatchLoaderContextProvider() {
316317 * Sets the batch loader environment provider that will be used to give context to batch load functions
317318 *
318319 * @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
320321 */
321322 public DataLoaderOptions setBatchLoaderContextProvider (BatchLoaderContextProvider contextProvider ) {
322323 return builder ().setBatchLoaderContextProvider (nonNull (contextProvider )).build ();
@@ -337,7 +338,7 @@ public DataLoaderOptions setBatchLoaderContextProvider(BatchLoaderContextProvide
337338 * Sets the value cache implementation to use for caching values, if caching is enabled.
338339 *
339340 * @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
341342 */
342343 public DataLoaderOptions setValueCache (ValueCache <?, ?> valueCache ) {
343344 return builder ().setValueCache (valueCache ).build ();
@@ -354,7 +355,7 @@ public ValueCacheOptions getValueCacheOptions() {
354355 * Sets the {@link ValueCacheOptions} that control how the {@link ValueCache} will be used
355356 *
356357 * @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
358359 */
359360 public DataLoaderOptions setValueCacheOptions (ValueCacheOptions valueCacheOptions ) {
360361 return builder ().setValueCacheOptions (nonNull (valueCacheOptions )).build ();
@@ -372,12 +373,29 @@ public BatchLoaderScheduler getBatchLoaderScheduler() {
372373 * to some future time.
373374 *
374375 * @param batchLoaderScheduler the scheduler
375- * @return the data loader options for fluent coding
376+ * @return a new data loader options instance for fluent coding
376377 */
377378 public DataLoaderOptions setBatchLoaderScheduler (BatchLoaderScheduler batchLoaderScheduler ) {
378379 return builder ().setBatchLoaderScheduler (batchLoaderScheduler ).build ();
379380 }
380381
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+
381399 private Builder builder () {
382400 return new Builder (this );
383401 }
@@ -394,6 +412,7 @@ public static class Builder {
394412 private BatchLoaderContextProvider environmentProvider ;
395413 private ValueCacheOptions valueCacheOptions ;
396414 private BatchLoaderScheduler batchLoaderScheduler ;
415+ private DataLoaderInstrumentation instrumentation ;
397416
398417 public Builder () {
399418 this (new DataLoaderOptions ()); // use the defaults of the DataLoaderOptions for this builder
@@ -411,6 +430,7 @@ public Builder() {
411430 this .environmentProvider = other .environmentProvider ;
412431 this .valueCacheOptions = other .valueCacheOptions ;
413432 this .batchLoaderScheduler = other .batchLoaderScheduler ;
433+ this .instrumentation = other .instrumentation ;
414434 }
415435
416436 public Builder setBatchingEnabled (boolean batchingEnabled ) {
@@ -468,27 +488,14 @@ public Builder setBatchLoaderScheduler(BatchLoaderScheduler batchLoaderScheduler
468488 return this ;
469489 }
470490
491+ public Builder setInstrumentation (DataLoaderInstrumentation instrumentation ) {
492+ this .instrumentation = nonNull (instrumentation );
493+ return this ;
494+ }
495+
471496 public DataLoaderOptions build () {
472497 return new DataLoaderOptions (this );
473498 }
474499
475500 }
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- }
494501}
0 commit comments