Class ObjectKey

java.lang.Object
com.bumptech.glide.signature.ObjectKey
All Implemented Interfaces:
Key

public final class ObjectKey extends Object implements Key
Wraps an Object, delegating equals(Object) and hashCode() to the wrapped Object and providing the bytes of the result of the Object's toString() method to the MessageDigest in updateDiskCacheKey(java.security.MessageDigest).

The Object's toString() method must be unique and suitable for use as a disk cache key.

  • Constructor Details

    • ObjectKey

      public ObjectKey(@NonNull Object object)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Description copied from interface: Key
      For caching to work correctly, implementations must implement this method and Key.hashCode().
      Specified by:
      equals in interface Key
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Description copied from interface: Key
      For caching to work correctly, implementations must implement this method and Key.equals(Object).
      Specified by:
      hashCode in interface Key
      Overrides:
      hashCode in class Object
    • updateDiskCacheKey

      public void updateDiskCacheKey(@NonNull MessageDigest messageDigest)
      Description copied from interface: Key
      Adds all uniquely identifying information to the given digest.

      Note - Using MessageDigest.reset() inside of this method will result in undefined behavior.

      Specified by:
      updateDiskCacheKey in interface Key