Class NodeId

    • Field Detail

      • UUID_FORMATTED_LENGTH

        public static final int UUID_FORMATTED_LENGTH
        Chars in a UUID String.
        See Also:
        Constant Field Values
      • UUID_BYTE_LENGTH

        public static final int UUID_BYTE_LENGTH
        Number of bytes in a UUID (16).
        See Also:
        Constant Field Values
    • Constructor Detail

      • NodeId

        public NodeId​(long msb,
                      long lsb)
        Creates a node identifier from the given 128 bits.
        Parameters:
        msb - most significant 64 bits
        lsb - least significant 64 bits
      • NodeId

        public NodeId​(UUID uuid)
        Creates a node identifier from the given UUID.
        Parameters:
        uuid - UUID
    • Method Detail

      • valueOf

        public static NodeId valueOf​(String uuid)
                              throws IllegalArgumentException
        Returns a node identifier that is represented by the given UUID string.
        Parameters:
        uuid - the UUID string
        Returns:
        the node identifier
        Throws:
        IllegalArgumentException - if the given string is null or not a valid UUID
      • randomId

        public static NodeId randomId()
        Creates a random node identifier using a secure random number generator.
      • getMostSignificantBits

        public long getMostSignificantBits()
        Returns the 64 most significant bits of this identifier.
        Returns:
        64 most significant bits
      • getLeastSignificantBits

        public long getLeastSignificantBits()
        Returns the 64 least significant bits of this identifier.
        Returns:
        64 least significant bits
      • getRawBytes

        public byte[] getRawBytes()
        Returns the 16 bytes of this identifier.
        Returns:
        newly allocated array of 16 bytes
      • denotesNode

        public boolean denotesNode()
        Returns true to indicate that this is a node identifier.
        Specified by:
        denotesNode in interface ItemId
        Returns:
        always true
        See Also:
        PropertyId, NodeId
      • compareTo

        public int compareTo​(NodeId that)
        Compares this identifier to the given other one.
        Specified by:
        compareTo in interface Comparable<NodeId>
        Parameters:
        that - other identifier
        Returns:
        -1, 0 or +1 if this identifier is less than, equal to, or greater than the given other identifier
      • toString

        public String toString()
        Returns the UUID string representation of this identifier.
        Overrides:
        toString in class Object
        Returns:
        UUID string
        See Also:
        UUID.toString()
      • hashCode

        public int hashCode()
        Returns a hash code of this identifier.
        Overrides:
        hashCode in class Object
        Returns:
        hash code