Class UIDUtils

  • @NonNullByDefault
    public class UIDUtils
    extends Object
    Utilities for UIDs.
    Markus Rathgeb - Initial contribution
    • Constructor Detail

      • UIDUtils

        public UIDUtils()
    • Method Detail

      • encode

        public static String encode​(String value)
        Encodes a given string to an UID using only allowed characters.

        The generated UID can be given to the decode(String) function and it will result into the given value.

        value - the string that should be encoded to a valid UID
        a string that if a valid UID (with respect to the allowed characters)
      • decode

        public static String decode​(String value)
        Decodes an UID that has been generated by the encode(String) function.

        This function should only be used for UIDs generated by the encode(String) function. For every other UID the result is rather useless or could result into an IllegalArgumentException.

        value - the UID to decode
        the decoded UID string
        IllegalArgumentException - if the given UID is not a valid encoded input