java.lang.Object
com.aquima.interactions.foundation.GUID
All Implemented Interfaces:
Serializable, Comparable<GUID>

public class GUID extends Object implements Serializable, Comparable<GUID>
The GUID class is a simple wrapper class for a string representing a unique identifier.

This class does enforce a few restrictions on the format of the string:

  • The string may not be empty or null.
  • The string may not contain any whitespaces.

The following processing is done on the string by the GUID class:

  • GUID strings are not case sensitive.
  • Excess whitespaces at the start and end of the string are stripped.
Since:
5.0
Author:
o.kerpershoek
See Also:
  • Constructor Details

    • GUID

      protected GUID(String strValue)
  • Method Details

    • valueOf

      public static GUID valueOf(String stringRepresentation)
      This method will convert a given string to a GUID. When an empty string or null is provided, this method will return null. When an invalid string is provided, this method will throw an invalid argument exception.
      Parameters:
      stringRepresentation - string containing the identifier.
      Returns:
      A valid GUID class, or null.
    • generate

      public static GUID generate()
      This method generates a new random unique GUID.
      Returns:
      a new random unique GUID.
    • getValue

      public String getValue()
      This method returns the internal value of the GUID. This value may be different to the original value passed to the GUID constructor, as the GUID performs a number of conversions.
      Returns:
      Internal value of the GUID.
    • compareTo

      public int compareTo(GUID other)
      Specified by:
      compareTo in interface Comparable<GUID>
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Get the string representation of this GUID.
      Overrides:
      toString in class Object
      Returns:
      String