1 package com.bumptech.glide.load.resource; 2 3 import com.bumptech.glide.load.ResourceDecoder; 4 import com.bumptech.glide.load.engine.Resource; 5 6 /** 7 * A simple {@link com.bumptech.glide.load.ResourceDecoder} that always returns null. 8 * 9 * @param <T> The type of the data that will be ignored by this class. 10 * @param <Z> The type of the decoded resource that will always be null. 11 */ 12 public class NullDecoder<T, Z> implements ResourceDecoder<T, Z> { 13 private static final NullDecoder<?, ?> NULL_DECODER = new NullDecoder<Object, Object>(); 14 15 /** 16 * Returns an instance of the NullDecoder for the given types. 17 * 18 * @param <T> The data type. 19 * @param <Z> The resource type. 20 */ 21 @SuppressWarnings("unchecked") 22 public static <T, Z> NullDecoder<T, Z> get() { 23 return (NullDecoder<T, Z>) NULL_DECODER; 24 } 25 26 @Override 27 public Resource<Z> decode(T source, int width, int height) { 28 return null; 29 } 30 31 @Override 32 public String getId() { 33 return ""; 34 } 35 } 36