com.bumptech.glide.load.model
Class GenericLoaderFactory

java.lang.Object
  extended by com.bumptech.glide.load.model.GenericLoaderFactory

public class GenericLoaderFactory
extends Object

Maintains a map of model class to factory to retrieve a ModelLoaderFactory and/or a ModelLoader for a given model type.


Constructor Summary
GenericLoaderFactory(Context context)
           
 
Method Summary
<T,Y> ModelLoader<T,Y>
buildModelLoader(Class<T> modelClass, Class<Y> resourceClass)
          Returns a ModelLoader for the given model and resource classes by either returning a cached ModelLoader or building a new a new ModelLoader using registered ModelLoaderFactorys.
<T,Y> ModelLoader<T,Y>
buildModelLoader(Class<T> modelClass, Class<Y> resourceClass, Context context)
          Deprecated. Use buildModelLoader(Class, Class) instead. Scheduled to be removed in Glide 4.0.
<T,Y> ModelLoaderFactory<T,Y>
register(Class<T> modelClass, Class<Y> resourceClass, ModelLoaderFactory<T,Y> factory)
          Registers the given ModelLoaderFactory for the given model and resource classes and returns the previous factory registered for the given model and resource classes or null if no such factory existed.
<T,Y> ModelLoaderFactory<T,Y>
unregister(Class<T> modelClass, Class<Y> resourceClass)
          Removes and returns the registered ModelLoaderFactory for the given model and resource classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericLoaderFactory

public GenericLoaderFactory(Context context)
Method Detail

unregister

public <T,Y> ModelLoaderFactory<T,Y> unregister(Class<T> modelClass,
                                                Class<Y> resourceClass)
Removes and returns the registered ModelLoaderFactory for the given model and resource classes. Returns null if no such factory is registered. Clears all cached model loaders.

Type Parameters:
T - The type of the model the class.
Y - The type of the resource class.
Parameters:
modelClass - The model class.
resourceClass - The resource class.

register

public <T,Y> ModelLoaderFactory<T,Y> register(Class<T> modelClass,
                                              Class<Y> resourceClass,
                                              ModelLoaderFactory<T,Y> factory)
Registers the given ModelLoaderFactory for the given model and resource classes and returns the previous factory registered for the given model and resource classes or null if no such factory existed. Clears all cached model loaders.

Type Parameters:
T - The type of the model.
Y - The type of the resource.
Parameters:
modelClass - The model class.
resourceClass - The resource class.
factory - The factory to register.

buildModelLoader

@Deprecated
public <T,Y> ModelLoader<T,Y> buildModelLoader(Class<T> modelClass,
                                                          Class<Y> resourceClass,
                                                          Context context)
Deprecated. Use buildModelLoader(Class, Class) instead. Scheduled to be removed in Glide 4.0.

Returns a ModelLoader for the given model and resource classes by either returning a cached ModelLoader or building a new a new ModelLoader using registered ModelLoaderFactorys. Returns null if no ModelLoaderFactory is registered for the given classes.

Type Parameters:
T - The type of the model.
Y - The type of the resource.
Parameters:
modelClass - The model class.
resourceClass - The resource class.
context - Unused

buildModelLoader

public <T,Y> ModelLoader<T,Y> buildModelLoader(Class<T> modelClass,
                                               Class<Y> resourceClass)
Returns a ModelLoader for the given model and resource classes by either returning a cached ModelLoader or building a new a new ModelLoader using registered ModelLoaderFactorys. Returns null if no ModelLoaderFactory is registered for the given classes.

Type Parameters:
T - The type of the model.
Y - The type of the resource.
Parameters:
modelClass - The model class.
resourceClass - The resource class.