/** * Prepends a new {@link ModelLoaderFactory} onto the beginning of the existing set so that the * constructed {@link ModelLoader} will be tried before all default and previously registered * {@link ModelLoader}s for the given model and data classes. * * <p>If you're attempting to add additional functionality or add a backup that should run only * after the default {@link ModelLoader}s run, use * {@link #append(Class, Class, ModelLoaderFactory)}. This method is best for adding an additional * case to Glide's existing functionality that should run first. This method will still run * Glide's default {@link ModelLoader}s if the prepended {@link ModelLoader}s fail. * * <p>If multiple {@link ModelLoaderFactory}s are registered for the same model and/or data * classes, the {@link ModelLoader}s they produce will be attempted in the order the * {@link ModelLoaderFactory}s were registered. Only if all {@link ModelLoader}s fail will the * entire request fail. * * @see #append(Class, Class, ModelLoaderFactory) * @see #replace(Class, Class, ModelLoaderFactory) * * @param modelClass The model class (e.g. URL, file path). * @param dataClass the data class (e.g. {@link java.io.InputStream}, * {@link java.io.FileDescriptor}). */ @NonNull public <Model, Data> Registry prepend( @NonNull Class<Model> modelClass, @NonNull Class<Data> dataClass, @NonNull ModelLoaderFactory<Model, Data> factory) { modelLoaderRegistry.prepend(modelClass, dataClass, factory); return this; }
/** * Prepends a new {@link ModelLoaderFactory} onto the beginning of the existing set so that the * constructed {@link ModelLoader} will be tried before all default and previously registered * {@link ModelLoader}s for the given model and data classes. * * <p>If you're attempting to add additional functionality or add a backup that should run only * after the default {@link ModelLoader}s run, use * {@link #append(Class, Class, ModelLoaderFactory)}. This method is best for adding an additional * case to Glide's existing functionality that should run first. This method will still run * Glide's default {@link ModelLoader}s if the prepended {@link ModelLoader}s fail. * * <p>If multiple {@link ModelLoaderFactory}s are registered for the same model and/or data * classes, the {@link ModelLoader}s they produce will be attempted in the order the * {@link ModelLoaderFactory}s were registered. Only if all {@link ModelLoader}s fail will the * entire request fail. * * @see #append(Class, Class, ModelLoaderFactory) * @see #replace(Class, Class, ModelLoaderFactory) * * @param modelClass The model class (e.g. URL, file path). * @param dataClass the data class (e.g. {@link java.io.InputStream}, * {@link java.io.FileDescriptor}). */ public <Model, Data> Registry prepend(Class<Model> modelClass, Class<Data> dataClass, ModelLoaderFactory<Model, Data> factory) { modelLoaderRegistry.prepend(modelClass, dataClass, factory); return this; }