Package com.bumptech.glide.load
Class Option<T>
java.lang.Object
com.bumptech.glide.load.Option<T>
- Type Parameters:
T- The type of the option (Integer,Bitmap.CompressFormatetc.), must implementequals(Object)andhashCode().
Defines available component (decoders, encoders, model loaders etc.) options with optional
default values and the ability to affect the resource disk cache key used by
DiskCacheStrategy.RESOURCE.
Implementations must either be unique (usually declared as static final variables), or
implement equals(Object) and hashCode().
Implementations can implement update(Object, MessageDigest) to make sure that the
disk cache key includes the specific option set.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn interface that updates aMessageDigestwith the given value as part of a process to generate a disk cache key. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Option<T>disk(String key, Option.CacheKeyUpdater<T> cacheKeyUpdater) Returns a newOptionthat uses the givenOption.CacheKeyUpdaterto update disk cache keys.static <T> Option<T>disk(String key, T defaultValue, Option.CacheKeyUpdater<T> cacheKeyUpdater) Returns a newOptionthat uses the givenOption.CacheKeyUpdaterto update disk cache keys and provides the given value as the default value.booleanReturns a reasonable default to use if no other value is set, ornull.inthashCode()static <T> Option<T>Returns a newOptionthat does not affect disk cache keys with anulldefault value.static <T> Option<T>Returns a newOptionthat does not affect disk cache keys with the given value as the default value.toString()voidupdate(T value, MessageDigest messageDigest) Updates the givenMessageDigestused to construct a cache key with the given value using theOption.CacheKeyUpdateroptionally provided in the constructor.
-
Method Details
-
memory
Returns a newOptionthat does not affect disk cache keys with anulldefault value.- Parameters:
key- A unique package prefixedStringthat identifies this option (must be stable across builds, soClass.getName()should not be used).
-
memory
Returns a newOptionthat does not affect disk cache keys with the given value as the default value.- Parameters:
key- A unique package prefixedStringthat identifies this option (must be stable across builds, soClass.getName()should not be used).
-
disk
@NonNull public static <T> Option<T> disk(@NonNull String key, @NonNull Option.CacheKeyUpdater<T> cacheKeyUpdater) Returns a newOptionthat uses the givenOption.CacheKeyUpdaterto update disk cache keys.- Parameters:
key- A unique package prefixedStringthat identifies this option (must be stable across builds, soClass.getName()should not be used).
-
disk
@NonNull public static <T> Option<T> disk(@NonNull String key, @Nullable T defaultValue, @NonNull Option.CacheKeyUpdater<T> cacheKeyUpdater) Returns a newOptionthat uses the givenOption.CacheKeyUpdaterto update disk cache keys and provides the given value as the default value.- Parameters:
key- A unique package prefixedStringthat identifies this option (must be stable across builds, soClass.getName()should not be used).
-
getDefaultValue
Returns a reasonable default to use if no other value is set, ornull. -
update
Updates the givenMessageDigestused to construct a cache key with the given value using theOption.CacheKeyUpdateroptionally provided in the constructor. -
equals
-
hashCode
public int hashCode() -
toString
-