1 package com.bumptech.glide.load.resource.transcode; 2 3 import com.bumptech.glide.load.engine.Resource; 4 5 /** 6 * A simple {@link ResourceTranscoder} that simply returns the given resource. 7 * 8 * @param <Z> The type of the resource that will be transcoded from and to. 9 */ 10 public class UnitTranscoder<Z> implements ResourceTranscoder<Z, Z> { 11 private static final UnitTranscoder<?> UNIT_TRANSCODER = new UnitTranscoder<Object>(); 12 13 @SuppressWarnings("unchecked") get()14 public static <Z> ResourceTranscoder<Z, Z> get() { 15 return (ResourceTranscoder<Z, Z>) UNIT_TRANSCODER; 16 } 17 18 @Override transcode(Resource<Z> toTranscode)19 public Resource<Z> transcode(Resource<Z> toTranscode) { 20 return toTranscode; 21 } 22 23 @Override getId()24 public String getId() { 25 return ""; 26 } 27 } 28