• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.bumptech.glide.load.model;
2 
3 import android.content.Context;
4 
5 /**
6  * An interface for creating a {@link ModelLoader} for a given model type. Will be retained statically so should not
7  * retain {@link Context} or any other objects that cannot be retained for the life of the application. ModelLoaders
8  * will not be retained statically so it is safe for any ModelLoader built by this factory to retain a reference to a
9  * {@link Context}.
10  *
11  * @param <T> The type of the model the {@link com.bumptech.glide.load.model.ModelLoader}s built by this factory
12  *           can handle
13  * @param <Y> The type of data the {@link com.bumptech.glide.load.model.ModelLoader}s built by this factory can load.
14  */
15 public interface ModelLoaderFactory<T, Y> {
16 
17     /**
18      * Build a concrete ModelLoader for this model type.
19      *
20      * @param context A context that cannot be retained by the factory but can be retained by the {@link ModelLoader}
21      * @param factories A map of classes to factories that can be used to construct additional {@link ModelLoader}s that
22      *                  this factory's {@link ModelLoader} may depend on
23      * @return A new {@link ModelLoader}
24      */
build(Context context, GenericLoaderFactory factories)25     ModelLoader<T, Y> build(Context context, GenericLoaderFactory factories);
26 
27     /**
28      * A lifecycle method that will be called when this factory is about to replaced.
29      */
teardown()30     void teardown();
31 }
32