Class Key

  • All Implemented Interfaces:
    java.lang.Comparable<Key>, ResourceConsumer

    @Beta
    public abstract class Key
    extends java.lang.Object
    implements java.lang.Comparable<Key>, ResourceConsumer
    Key class for Intents.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Key​(long hash)  
    • Constructor Detail

      • Key

        protected Key​(long hash)
    • Method Detail

      • hash

        public long hash()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public abstract boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • of

        public static Key of​(java.lang.String key,
                             ApplicationId appId)
        Creates a key based on the provided string.

        Note: Two keys with equal value, but different appId, are not equal. Warning: it is caller responsibility to make sure the hashed value of value is unique.

        Parameters:
        key - the provided string
        appId - application id to associate with this key
        Returns:
        the key for the string
      • of

        public static Key of​(long key,
                             ApplicationId appId)
        Creates a key based on the provided long.

        Note: Two keys with equal value, but different appId, are not equal. Also, "10" and 10L are different.

        Parameters:
        key - the provided long
        appId - application id to associate with this key
        Returns:
        the key for the long