@@ -75,7 +75,10 @@ public class DataLoader<K, V> {
7575 * @param <V> the value type
7676 *
7777 * @return a new DataLoader
78+ *
79+ * @deprecated use {@link DataLoaderFactory} instead
7880 */
81+ @ Deprecated
7982 public static <K , V > DataLoader <K , V > newDataLoader (BatchLoader <K , V > batchLoadFunction ) {
8083 return newDataLoader (batchLoadFunction , null );
8184 }
@@ -89,9 +92,12 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoader<K, V> batchLoadF
8992 * @param <V> the value type
9093 *
9194 * @return a new DataLoader
95+ *
96+ * @deprecated use {@link DataLoaderFactory} instead
9297 */
98+ @ Deprecated
9399 public static <K , V > DataLoader <K , V > newDataLoader (BatchLoader <K , V > batchLoadFunction , DataLoaderOptions options ) {
94- return new DataLoader <> (batchLoadFunction , options );
100+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
95101 }
96102
97103 /**
@@ -110,7 +116,10 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoader<K, V> batchLoadF
110116 * @param <V> the value type
111117 *
112118 * @return a new DataLoader
119+ *
120+ * @deprecated use {@link DataLoaderFactory} instead
113121 */
122+ @ Deprecated
114123 public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoader <K , Try <V >> batchLoadFunction ) {
115124 return newDataLoaderWithTry (batchLoadFunction , null );
116125 }
@@ -127,11 +136,12 @@ public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoader<K, Try<V>
127136 *
128137 * @return a new DataLoader
129138 *
130- * @see #newDataLoaderWithTry(BatchLoader)
139+ * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
140+ * @deprecated use {@link DataLoaderFactory} instead
131141 */
132- @ SuppressWarnings ( "unchecked" )
142+ @ Deprecated
133143 public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoader <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
134- return new DataLoader <>(( BatchLoader < K , V >) batchLoadFunction , options );
144+ return DataLoaderFactory . mkDataLoader ( batchLoadFunction , options );
135145 }
136146
137147 /**
@@ -143,7 +153,10 @@ public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoader<K, Try<V>
143153 * @param <V> the value type
144154 *
145155 * @return a new DataLoader
156+ *
157+ * @deprecated use {@link DataLoaderFactory} instead
146158 */
159+ @ Deprecated
147160 public static <K , V > DataLoader <K , V > newDataLoader (BatchLoaderWithContext <K , V > batchLoadFunction ) {
148161 return newDataLoader (batchLoadFunction , null );
149162 }
@@ -157,9 +170,12 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoaderWithContext<K, V>
157170 * @param <V> the value type
158171 *
159172 * @return a new DataLoader
173+ *
174+ * @deprecated use {@link DataLoaderFactory} instead
160175 */
176+ @ Deprecated
161177 public static <K , V > DataLoader <K , V > newDataLoader (BatchLoaderWithContext <K , V > batchLoadFunction , DataLoaderOptions options ) {
162- return new DataLoader <> (batchLoadFunction , options );
178+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
163179 }
164180
165181 /**
@@ -178,7 +194,10 @@ public static <K, V> DataLoader<K, V> newDataLoader(BatchLoaderWithContext<K, V>
178194 * @param <V> the value type
179195 *
180196 * @return a new DataLoader
197+ *
198+ * @deprecated use {@link DataLoaderFactory} instead
181199 */
200+ @ Deprecated
182201 public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoaderWithContext <K , Try <V >> batchLoadFunction ) {
183202 return newDataLoaderWithTry (batchLoadFunction , null );
184203 }
@@ -195,10 +214,12 @@ public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoaderWithContex
195214 *
196215 * @return a new DataLoader
197216 *
198- * @see #newDataLoaderWithTry(BatchLoader)
217+ * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
218+ * @deprecated use {@link DataLoaderFactory} instead
199219 */
220+ @ Deprecated
200221 public static <K , V > DataLoader <K , V > newDataLoaderWithTry (BatchLoaderWithContext <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
201- return new DataLoader <> (batchLoadFunction , options );
222+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
202223 }
203224
204225 /**
@@ -210,7 +231,10 @@ public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoaderWithContex
210231 * @param <V> the value type
211232 *
212233 * @return a new DataLoader
234+ *
235+ * @deprecated use {@link DataLoaderFactory} instead
213236 */
237+ @ Deprecated
214238 public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoader <K , V > batchLoadFunction ) {
215239 return newMappedDataLoader (batchLoadFunction , null );
216240 }
@@ -224,9 +248,12 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoader<K, V
224248 * @param <V> the value type
225249 *
226250 * @return a new DataLoader
251+ *
252+ * @deprecated use {@link DataLoaderFactory} instead
227253 */
254+ @ Deprecated
228255 public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoader <K , V > batchLoadFunction , DataLoaderOptions options ) {
229- return new DataLoader <> (batchLoadFunction , options );
256+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
230257 }
231258
232259 /**
@@ -246,7 +273,10 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoader<K, V
246273 * @param <V> the value type
247274 *
248275 * @return a new DataLoader
276+ *
277+ * @deprecated use {@link DataLoaderFactory} instead
249278 */
279+ @ Deprecated
250280 public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoader <K , Try <V >> batchLoadFunction ) {
251281 return newMappedDataLoaderWithTry (batchLoadFunction , null );
252282 }
@@ -263,10 +293,12 @@ public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoad
263293 *
264294 * @return a new DataLoader
265295 *
266- * @see #newDataLoaderWithTry(BatchLoader)
296+ * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
297+ * @deprecated use {@link DataLoaderFactory} instead
267298 */
299+ @ Deprecated
268300 public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoader <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
269- return new DataLoader <> (batchLoadFunction , options );
301+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
270302 }
271303
272304 /**
@@ -278,7 +310,10 @@ public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoad
278310 * @param <V> the value type
279311 *
280312 * @return a new DataLoader
313+ *
314+ * @deprecated use {@link DataLoaderFactory} instead
281315 */
316+ @ Deprecated
282317 public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoaderWithContext <K , V > batchLoadFunction ) {
283318 return newMappedDataLoader (batchLoadFunction , null );
284319 }
@@ -292,9 +327,12 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoaderWithC
292327 * @param <V> the value type
293328 *
294329 * @return a new DataLoader
330+ *
331+ * @deprecated use {@link DataLoaderFactory} instead
295332 */
333+ @ Deprecated
296334 public static <K , V > DataLoader <K , V > newMappedDataLoader (MappedBatchLoaderWithContext <K , V > batchLoadFunction , DataLoaderOptions options ) {
297- return new DataLoader <> (batchLoadFunction , options );
335+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
298336 }
299337
300338 /**
@@ -313,7 +351,10 @@ public static <K, V> DataLoader<K, V> newMappedDataLoader(MappedBatchLoaderWithC
313351 * @param <V> the value type
314352 *
315353 * @return a new DataLoader
354+ *
355+ * @deprecated use {@link DataLoaderFactory} instead
316356 */
357+ @ Deprecated
317358 public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoaderWithContext <K , Try <V >> batchLoadFunction ) {
318359 return newMappedDataLoaderWithTry (batchLoadFunction , null );
319360 }
@@ -330,32 +371,40 @@ public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoad
330371 *
331372 * @return a new DataLoader
332373 *
333- * @see #newDataLoaderWithTry(BatchLoader)
374+ * @see DataLoaderFactory#newDataLoaderWithTry(BatchLoader)
375+ * @deprecated use {@link DataLoaderFactory} instead
334376 */
377+ @ Deprecated
335378 public static <K , V > DataLoader <K , V > newMappedDataLoaderWithTry (MappedBatchLoaderWithContext <K , Try <V >> batchLoadFunction , DataLoaderOptions options ) {
336- return new DataLoader <> (batchLoadFunction , options );
379+ return DataLoaderFactory . mkDataLoader (batchLoadFunction , options );
337380 }
338381
339382 /**
340383 * Creates a new data loader with the provided batch load function, and default options.
341384 *
342385 * @param batchLoadFunction the batch load function to use
386+ *
387+ * @deprecated use {@link DataLoaderFactory} instead
343388 */
389+ @ Deprecated
344390 public DataLoader (BatchLoader <K , V > batchLoadFunction ) {
345- this (batchLoadFunction , null );
391+ this (( Object ) batchLoadFunction , null );
346392 }
347393
348394 /**
349395 * Creates a new data loader with the provided batch load function and options.
350396 *
351397 * @param batchLoadFunction the batch load function to use
352398 * @param options the batch load options
399+ *
400+ * @deprecated use {@link DataLoaderFactory} instead
353401 */
402+ @ Deprecated
354403 public DataLoader (BatchLoader <K , V > batchLoadFunction , DataLoaderOptions options ) {
355404 this ((Object ) batchLoadFunction , options );
356405 }
357406
358- private DataLoader (Object batchLoadFunction , DataLoaderOptions options ) {
407+ DataLoader (Object batchLoadFunction , DataLoaderOptions options ) {
359408 DataLoaderOptions loaderOptions = options == null ? new DataLoaderOptions () : options ;
360409 this .futureCache = determineCacheMap (loaderOptions );
361410 // order of keys matter in data loader
0 commit comments