diff --git a/src/main/java/org/dataloader/DataLoader.java b/src/main/java/org/dataloader/DataLoader.java
index d03e5ac..7a50619 100644
--- a/src/main/java/org/dataloader/DataLoader.java
+++ b/src/main/java/org/dataloader/DataLoader.java
@@ -58,7 +58,7 @@
*
* A call to the batch loader might result in individual exception failures for item with the returned list. if
* you want to capture these specific item failures then use {@link org.dataloader.Try} as a return value and
- * create the data loader with {@link #newDataLoaderWithTry(BatchLoader)} form. The Try values will be interpreted
+ * create the data loader with {@link DataLoaderFactory#newDataLoaderWithTry(BatchLoader)} form. The Try values will be interpreted
* as either success values or cause the {@link #load(Object)} promise to complete exceptionally.
*
* @param type parameter indicating the type of the data load keys
@@ -70,6 +70,7 @@
@NullMarked
public class DataLoader {
+ private final @Nullable String name;
private final DataLoaderHelper helper;
private final StatisticsCollector stats;
private final CacheMap futureCache;
@@ -77,317 +78,13 @@ public class DataLoader {
private final DataLoaderOptions options;
private final Object batchLoadFunction;
- /**
- * Creates new DataLoader with the specified batch loader function and default options
- * (batching, caching and unlimited batch size).
- *
- * @param batchLoadFunction the batch load function to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newDataLoader(BatchLoader batchLoadFunction) {
- return newDataLoader(batchLoadFunction, null);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function with the provided options
- *
- * @param batchLoadFunction the batch load function to use
- * @param options the options to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newDataLoader(BatchLoader batchLoadFunction, @Nullable DataLoaderOptions options) {
- return DataLoaderFactory.mkDataLoader(batchLoadFunction, options);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function and default options
- * (batching, caching and unlimited batch size) where the batch loader function returns a list of
- * {@link org.dataloader.Try} objects.
- *
- * If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
- * you can use this form to create the data loader.
- *
- * Using Try objects allows you to capture a value returned or an exception that might
- * have occurred trying to get a value. .
- *
- * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newDataLoaderWithTry(BatchLoader> batchLoadFunction) {
- return newDataLoaderWithTry(batchLoadFunction, null);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function and with the provided options
- * where the batch loader function returns a list of
- * {@link org.dataloader.Try} objects.
- *
- * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
- * @param options the options to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newDataLoaderWithTry(BatchLoader> batchLoadFunction, @Nullable DataLoaderOptions options) {
- return DataLoaderFactory.mkDataLoader(batchLoadFunction, options);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function and default options
- * (batching, caching and unlimited batch size).
- *
- * @param batchLoadFunction the batch load function to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newDataLoader(BatchLoaderWithContext batchLoadFunction) {
- return newDataLoader(batchLoadFunction, null);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function with the provided options
- *
- * @param batchLoadFunction the batch load function to use
- * @param options the options to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newDataLoader(BatchLoaderWithContext batchLoadFunction, @Nullable DataLoaderOptions options) {
- return DataLoaderFactory.mkDataLoader(batchLoadFunction, options);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function and default options
- * (batching, caching and unlimited batch size) where the batch loader function returns a list of
- * {@link org.dataloader.Try} objects.
- *
- * If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
- * you can use this form to create the data loader.
- *
- * Using Try objects allows you to capture a value returned or an exception that might
- * have occurred trying to get a value. .
- *
- * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newDataLoaderWithTry(BatchLoaderWithContext> batchLoadFunction) {
- return newDataLoaderWithTry(batchLoadFunction, null);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function and with the provided options
- * where the batch loader function returns a list of
- * {@link org.dataloader.Try} objects.
- *
- * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
- * @param options the options to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newDataLoaderWithTry(BatchLoaderWithContext> batchLoadFunction, @Nullable DataLoaderOptions options) {
- return DataLoaderFactory.mkDataLoader(batchLoadFunction, options);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function and default options
- * (batching, caching and unlimited batch size).
- *
- * @param batchLoadFunction the batch load function to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newMappedDataLoader(MappedBatchLoader batchLoadFunction) {
- return newMappedDataLoader(batchLoadFunction, null);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function with the provided options
- *
- * @param batchLoadFunction the batch load function to use
- * @param options the options to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newMappedDataLoader(MappedBatchLoader batchLoadFunction, @Nullable DataLoaderOptions options) {
- return DataLoaderFactory.mkDataLoader(batchLoadFunction, options);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function and default options
- * (batching, caching and unlimited batch size) where the batch loader function returns a list of
- * {@link org.dataloader.Try} objects.
- *
- * If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
- * you can use this form to create the data loader.
- *
- * Using Try objects allows you to capture a value returned or an exception that might
- * have occurred trying to get a value. .
- *
- *
- * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newMappedDataLoaderWithTry(MappedBatchLoader> batchLoadFunction) {
- return newMappedDataLoaderWithTry(batchLoadFunction, null);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function and with the provided options
- * where the batch loader function returns a list of
- * {@link org.dataloader.Try} objects.
- *
- * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
- * @param options the options to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newMappedDataLoaderWithTry(MappedBatchLoader> batchLoadFunction, @Nullable DataLoaderOptions options) {
- return DataLoaderFactory.mkDataLoader(batchLoadFunction, options);
- }
-
- /**
- * Creates new DataLoader with the specified mapped batch loader function and default options
- * (batching, caching and unlimited batch size).
- *
- * @param batchLoadFunction the batch load function to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newMappedDataLoader(MappedBatchLoaderWithContext batchLoadFunction) {
- return newMappedDataLoader(batchLoadFunction, null);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function with the provided options
- *
- * @param batchLoadFunction the batch load function to use
- * @param options the options to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newMappedDataLoader(MappedBatchLoaderWithContext batchLoadFunction, @Nullable DataLoaderOptions options) {
- return DataLoaderFactory.mkDataLoader(batchLoadFunction, options);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function and default options
- * (batching, caching and unlimited batch size) where the batch loader function returns a list of
- * {@link org.dataloader.Try} objects.
- *
- * If it's important you to know the exact status of each item in a batch call and whether it threw exceptions then
- * you can use this form to create the data loader.
- *
- * Using Try objects allows you to capture a value returned or an exception that might
- * have occurred trying to get a value. .
- *
- * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newMappedDataLoaderWithTry(MappedBatchLoaderWithContext> batchLoadFunction) {
- return newMappedDataLoaderWithTry(batchLoadFunction, null);
- }
-
- /**
- * Creates new DataLoader with the specified batch loader function and with the provided options
- * where the batch loader function returns a list of
- * {@link org.dataloader.Try} objects.
- *
- * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
- * @param options the options to use
- * @param the key type
- * @param the value type
- * @return a new DataLoader
- * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public static DataLoader newMappedDataLoaderWithTry(MappedBatchLoaderWithContext> batchLoadFunction, @Nullable DataLoaderOptions options) {
- return DataLoaderFactory.mkDataLoader(batchLoadFunction, options);
- }
-
- /**
- * Creates a new data loader with the provided batch load function, and default options.
- *
- * @param batchLoadFunction the batch load function to use
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public DataLoader(BatchLoader batchLoadFunction) {
- this((Object) batchLoadFunction, null);
- }
-
- /**
- * Creates a new data loader with the provided batch load function and options.
- *
- * @param batchLoadFunction the batch load function to use
- * @param options the batch load options
- * @deprecated use {@link DataLoaderFactory} instead
- */
- @Deprecated
- public DataLoader(BatchLoader batchLoadFunction, @Nullable DataLoaderOptions options) {
- this((Object) batchLoadFunction, options);
- }
-
@VisibleForTesting
- DataLoader(Object batchLoadFunction, @Nullable DataLoaderOptions options) {
- this(batchLoadFunction, options, Clock.systemUTC());
+ DataLoader(@Nullable String name, Object batchLoadFunction, @Nullable DataLoaderOptions options) {
+ this(name, batchLoadFunction, options, Clock.systemUTC());
}
@VisibleForTesting
- DataLoader(Object batchLoadFunction, @Nullable DataLoaderOptions options, Clock clock) {
+ DataLoader(@Nullable String name, Object batchLoadFunction, @Nullable DataLoaderOptions options, Clock clock) {
DataLoaderOptions loaderOptions = options == null ? new DataLoaderOptions() : options;
this.futureCache = determineFutureCache(loaderOptions);
this.valueCache = determineValueCache(loaderOptions);
@@ -395,6 +92,7 @@ public DataLoader(BatchLoader batchLoadFunction, @Nullable DataLoaderOptio
this.stats = nonNull(loaderOptions.getStatisticsCollector());
this.batchLoadFunction = nonNull(batchLoadFunction);
this.options = loaderOptions;
+ this.name = name;
this.helper = new DataLoaderHelper<>(this, batchLoadFunction, loaderOptions, this.futureCache, this.valueCache, this.stats, clock);
}
@@ -410,6 +108,13 @@ private ValueCache determineValueCache(DataLoaderOptions loaderOptions) {
return (ValueCache) loaderOptions.valueCache().orElseGet(ValueCache::defaultValueCache);
}
+ /**
+ * @return the name of the DataLoader which can be null
+ */
+ public @Nullable String getName() {
+ return name;
+ }
+
/**
* @return the options used to build this {@link DataLoader}
*/
@@ -787,4 +492,11 @@ public ValueCache getValueCache() {
return valueCache;
}
+ @Override
+ public String toString() {
+ return "DataLoader{" +
+ "name='" + name + '\'' +
+ ", stats=" + stats +
+ '}';
+ }
}
diff --git a/src/main/java/org/dataloader/DataLoaderFactory.java b/src/main/java/org/dataloader/DataLoaderFactory.java
index ef1a287..a95e158 100644
--- a/src/main/java/org/dataloader/DataLoaderFactory.java
+++ b/src/main/java/org/dataloader/DataLoaderFactory.java
@@ -3,6 +3,8 @@
import org.dataloader.annotations.PublicApi;
import org.jspecify.annotations.Nullable;
+import static org.dataloader.impl.Assertions.nonNull;
+
/**
* A factory class to create {@link DataLoader}s
*/
@@ -23,6 +25,20 @@ public static DataLoader newDataLoader(BatchLoader batchLoadF
return newDataLoader(batchLoadFunction, null);
}
+ /**
+ * Creates new DataLoader with the specified batch loader function and default options
+ * (batching, caching and unlimited batch size).
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ */
+ public static DataLoader newDataLoader(String name, BatchLoader batchLoadFunction) {
+ return newDataLoader(name, batchLoadFunction, null);
+ }
+
/**
* Creates new DataLoader with the specified batch loader function with the provided options
*
@@ -33,7 +49,21 @@ public static DataLoader newDataLoader(BatchLoader batchLoadF
* @return a new DataLoader
*/
public static DataLoader newDataLoader(BatchLoader batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function with the provided options
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ */
+ public static DataLoader newDataLoader(String name, BatchLoader batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -69,7 +99,24 @@ public static DataLoader newDataLoaderWithTry(BatchLoader
* @see #newDataLoaderWithTry(BatchLoader)
*/
public static DataLoader newDataLoaderWithTry(BatchLoader> batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function and with the provided options
+ * where the batch loader function returns a list of
+ * {@link org.dataloader.Try} objects.
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ * @see #newDataLoaderWithTry(BatchLoader)
+ */
+ public static DataLoader newDataLoaderWithTry(String name, BatchLoader> batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -95,7 +142,21 @@ public static DataLoader newDataLoader(BatchLoaderWithContext
* @return a new DataLoader
*/
public static DataLoader newDataLoader(BatchLoaderWithContext batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function with the provided options
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ */
+ public static DataLoader newDataLoader(String name, BatchLoaderWithContext batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -131,7 +192,24 @@ public static DataLoader newDataLoaderWithTry(BatchLoaderWithContex
* @see #newDataLoaderWithTry(BatchLoader)
*/
public static DataLoader newDataLoaderWithTry(BatchLoaderWithContext> batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function and with the provided options
+ * where the batch loader function returns a list of
+ * {@link org.dataloader.Try} objects.
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ * @see #newDataLoaderWithTry(BatchLoader)
+ */
+ public static DataLoader newDataLoaderWithTry(String name, BatchLoaderWithContext> batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -157,7 +235,20 @@ public static DataLoader newMappedDataLoader(MappedBatchLoader DataLoader newMappedDataLoader(MappedBatchLoader batchLoadFunction, @Nullable DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function with the provided options
+ *
+ * @param batchLoadFunction the batch load function to use
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ */
+ public static DataLoader newMappedDataLoader(String name, MappedBatchLoader batchLoadFunction, @Nullable DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -194,7 +285,24 @@ public static DataLoader newMappedDataLoaderWithTry(MappedBatchLoad
* @see #newDataLoaderWithTry(BatchLoader)
*/
public static DataLoader newMappedDataLoaderWithTry(MappedBatchLoader> batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function and with the provided options
+ * where the batch loader function returns a list of
+ * {@link org.dataloader.Try} objects.
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ * @see #newDataLoaderWithTry(BatchLoader)
+ */
+ public static DataLoader newMappedDataLoaderWithTry(String name, MappedBatchLoader> batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -220,7 +328,21 @@ public static DataLoader newMappedDataLoader(MappedBatchLoaderWithC
* @return a new DataLoader
*/
public static DataLoader newMappedDataLoader(MappedBatchLoaderWithContext batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function with the provided options
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ */
+ public static DataLoader newMappedDataLoader(String name, MappedBatchLoaderWithContext batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -256,7 +378,24 @@ public static DataLoader newMappedDataLoaderWithTry(MappedBatchLoad
* @see #newDataLoaderWithTry(BatchLoader)
*/
public static DataLoader newMappedDataLoaderWithTry(MappedBatchLoaderWithContext> batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function and with the provided options
+ * where the batch loader function returns a list of
+ * {@link org.dataloader.Try} objects.
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ * @see #newDataLoaderWithTry(BatchLoader)
+ */
+ public static DataLoader newMappedDataLoaderWithTry(String name, MappedBatchLoaderWithContext> batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -282,7 +421,21 @@ public static DataLoader newPublisherDataLoader(BatchPublisher DataLoader newPublisherDataLoader(BatchPublisher batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function with the provided options
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ */
+ public static DataLoader newPublisherDataLoader(String name, BatchPublisher batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -318,7 +471,24 @@ public static DataLoader newPublisherDataLoaderWithTry(BatchPublish
* @see #newDataLoaderWithTry(BatchLoader)
*/
public static DataLoader newPublisherDataLoaderWithTry(BatchPublisher> batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function and with the provided options
+ * where the batch loader function returns a list of
+ * {@link org.dataloader.Try} objects.
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ * @see #newDataLoaderWithTry(BatchLoader)
+ */
+ public static DataLoader newPublisherDataLoaderWithTry(String name, BatchPublisher> batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -344,7 +514,21 @@ public static DataLoader newPublisherDataLoader(BatchPublisherWithC
* @return a new DataLoader
*/
public static DataLoader newPublisherDataLoader(BatchPublisherWithContext batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function with the provided options
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ */
+ public static DataLoader newPublisherDataLoader(String name, BatchPublisherWithContext batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -380,7 +564,24 @@ public static DataLoader newPublisherDataLoaderWithTry(BatchPublish
* @see #newPublisherDataLoaderWithTry(BatchPublisher)
*/
public static DataLoader newPublisherDataLoaderWithTry(BatchPublisherWithContext> batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function and with the provided options
+ * where the batch loader function returns a list of
+ * {@link org.dataloader.Try} objects.
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ * @see #newPublisherDataLoaderWithTry(BatchPublisher)
+ */
+ public static DataLoader newPublisherDataLoaderWithTry(String name, BatchPublisherWithContext> batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -406,7 +607,21 @@ public static DataLoader newMappedPublisherDataLoader(MappedBatchPu
* @return a new DataLoader
*/
public static DataLoader newMappedPublisherDataLoader(MappedBatchPublisher batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function with the provided options
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ */
+ public static DataLoader newMappedPublisherDataLoader(String name, MappedBatchPublisher batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -442,7 +657,24 @@ public static DataLoader newMappedPublisherDataLoaderWithTry(Mapped
* @see #newDataLoaderWithTry(BatchLoader)
*/
public static DataLoader newMappedPublisherDataLoaderWithTry(MappedBatchPublisher> batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function and with the provided options
+ * where the batch loader function returns a list of
+ * {@link org.dataloader.Try} objects.
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects
+ * @param options the options to use
+ * @param the key type
+ * @param the value type
+ * @return a new DataLoader
+ * @see #newDataLoaderWithTry(BatchLoader)
+ */
+ public static DataLoader newMappedPublisherDataLoaderWithTry(String name, MappedBatchPublisher> batchLoadFunction, DataLoaderOptions options) {
+ return mkDataLoader(nonNull(name), batchLoadFunction, options);
}
/**
@@ -468,7 +700,21 @@ public static DataLoader newMappedPublisherDataLoader(MappedBatchPu
* @return a new DataLoader
*/
public static DataLoader newMappedPublisherDataLoader(MappedBatchPublisherWithContext batchLoadFunction, DataLoaderOptions options) {
- return mkDataLoader(batchLoadFunction, options);
+ return mkDataLoader(null, batchLoadFunction, options);
+ }
+
+ /**
+ * Creates new DataLoader with the specified batch loader function with the provided options
+ *
+ * @param name the name to use
+ * @param batchLoadFunction the batch load function to use
+ * @param options the options to use
+ * @param the key type
+ * @param