Class ShortId

java.lang.Object
com.amalgamasimulation.utils.ShortId

public class ShortId extends Object
Short unique human-readable identifier represented as "ABC-123-XYZ". Only Latin capital letters and numbers are allowed in the string representation. Unlike, UUID, true uniqueness is not guaranteed but the shortness of its format provides more human readability.

The allowed formats include:

  • ABC-123-XYZ
  • 123-ABC-456
    • Constructor Details

      • ShortId

        public ShortId()
        Creates a new unique instance of ShortId
    • Method Details

      • getValue

        public String getValue()
      • parse

        public static ShortId parse(String string)
        Parses the given string and returns the instance of ShortId. Throws an IllegalFormatException if the format is different from one of the following forms:
      • ABC-123-XYZ
      • 123-ABC-456
      • Parameters:
        string -
        Returns:
        new instance of ShortId
      • toString

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

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

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