-
public final class Option<T>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 .
Implementations must either be unique (usually declared as static final variables), or implement equals and hashCode.
Implementations can implement update to make sure that the disk cache key includes the specific option set.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceOption.CacheKeyUpdaterAn interface that updates a MessageDigest with the given value as part of a process togenerate a disk cache key.
-
Field Summary
Fields Modifier and Type Field Description private final TdefaultValue
-
Method Summary
Modifier and Type Method Description TgetDefaultValue()Returns a reasonable default to use if no other value is set, or {@code null}.static <T> Option<T>memory(@NonNull() String key)Returns a new Option that does not affect disk cache keys with a {@code null}defaultvalue.static <T> Option<T>memory(@NonNull() String key, @NonNull() T defaultValue)Returns a new Option that does not affect disk cache keys with the given value as thedefault value. static <T> Option<T>disk(@NonNull() String key, @NonNull() Option.CacheKeyUpdater<T> cacheKeyUpdater)Returns a new Option that uses the given to update disk cache keys. static <T> Option<T>disk(@NonNull() String key, @Nullable() T defaultValue, @NonNull() Option.CacheKeyUpdater<T> cacheKeyUpdater)Returns a new Option that uses the given to update disk cache keys and provides thegiven value as the default value. voidupdate(@NonNull() T value, @NonNull() MessageDigest messageDigest)Updates the given MessageDigest used to construct a cache key with the given valueusing the com.mobwith.imgmodule.load.Option.CacheKeyUpdater optionally provided in theconstructor. booleanequals(Object o)inthashCode()StringtoString()-
-
Method Detail
-
getDefaultValue
@Nullable() T getDefaultValue()
Returns a reasonable default to use if no other value is set, or
{@code null}.
-
memory
@NonNull() static <T> Option<T> memory(@NonNull() String key)
Returns a new Option that does not affect disk cache keys with a
{@code null}defaultvalue.
-
memory
@NonNull() static <T> Option<T> memory(@NonNull() String key, @NonNull() T defaultValue)
Returns a new Option that does not affect disk cache keys with the given value as thedefault value.
-
disk
@NonNull() static <T> Option<T> disk(@NonNull() String key, @NonNull() Option.CacheKeyUpdater<T> cacheKeyUpdater)
Returns a new Option that uses the given to update disk cache keys.
-
disk
@NonNull() static <T> Option<T> disk(@NonNull() String key, @Nullable() T defaultValue, @NonNull() Option.CacheKeyUpdater<T> cacheKeyUpdater)
Returns a new Option that uses the given to update disk cache keys and provides thegiven value as the default value.
-
update
void update(@NonNull() T value, @NonNull() MessageDigest messageDigest)
Updates the given MessageDigest used to construct a cache key with the given valueusing the com.mobwith.imgmodule.load.Option.CacheKeyUpdater optionally provided in theconstructor.
-
hashCode
int hashCode()
-
-
-
-