Class Guid

  • All Implemented Interfaces:
    Id, java.io.Serializable

    public class Guid
    extends java.lang.Object
    implements Id

    A globally unique identifier, as an implementation of a RFC4122 type 4 UUID.

    An instance of Guid can be used in several threads concurrently.

    Author:
    agz
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Guid()
      Creates a new Guid, representing an already initialized, valid globally unique id-value.
      Guid​(java.lang.String string)
      Creates a new Guid, initialized with the id-value represented by the specified string.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getString()
      Returns the string-representation of this Id.
      java.lang.String getString32()
      Returns a 32 byte representation of this Guid, that is analogous to the standard 36 byte representation but without the separating "-"-characters.
      java.lang.String getString36()
      Returns the standard 36 byte representation of this Guid.
      int hashCode()  
      protected java.lang.Object readResolve()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Guid

        public Guid()
        Creates a new Guid, representing an already initialized, valid globally unique id-value.
      • Guid

        public Guid​(java.lang.String string)
        Creates a new Guid, initialized with the id-value represented by the specified string.

        The specified string may be the standard 36 bytes representation or a reduced 32 bytes representation where the separating "-"-characters are omitted. For letter-characters both upper and lower case is accepted.

        The specified string must not be null.

        Parameters:
        string - string representation of a guid
        See Also:
        getString()
    • Method Detail

      • readResolve

        protected java.lang.Object readResolve()
      • getString

        public final java.lang.String getString()
        Returns the string-representation of this Id.

        Returns the standard 36 bytes representation of this Guid.

        Specified by:
        getString in interface Id
        Returns:
        the string-representation of this Id
        See Also:
        getString36(), getString32(), Guid(String)
      • getString32

        public final java.lang.String getString32()
        Returns a 32 byte representation of this Guid, that is analogous to the standard 36 byte representation but without the separating "-"-characters.

        Letters are in upper case always.

        Returns:
        32 byte representation of this Guid
        See Also:
        getString36(), Guid(String)
      • getString36

        public final java.lang.String getString36()
        Returns the standard 36 byte representation of this Guid.

        Letters are in upper case always.

        Returns:
        36 byte standard representation of this Guid
        See Also:
        getString32(), Guid(String)
      • equals

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

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object