Class UuidValidator


  • public class UuidValidator
    extends Object
    Utility for UUID validation.
    • Method Detail

      • isValid

        protected static boolean isValid​(byte[] uuid)
        Checks if the UUID byte array is valid.
        Parameters:
        uuid - a UUID byte array
        Returns:
        true if valid, false if invalid
      • validate

        public static void validate​(byte[] uuid)
        Checks if the UUID byte array is valid.
        Parameters:
        uuid - a UUID
        Throws:
        InvalidUuidException - if invalid
      • isValid

        public static boolean isValid​(String uuid)
        Checks if the UUID string is valid.
         Examples of accepted formats:
         
         12345678abcdabcdabcd123456789abcd       (32 hexadecimal chars, lower case and without dash)
         12345678ABCDABCDABCD123456789ABCD       (32 hexadecimal chars, UPPER CASE and without dash)
         12345678-abcd-abcd-abcd-123456789abcd   (36 hexadecimal chars, lower case and with dash)
         12345678-ABCD-ABCD-ABCD-123456789ABCD   (36 hexadecimal chars, UPPER CASE and with dash)
         
        Parameters:
        uuid - a UUID string
        Returns:
        true if valid, false if invalid
      • validate

        public static void validate​(String uuid)
        Checks if the UUID string is a valid.
        Parameters:
        uuid - a UUID
        Throws:
        InvalidUuidException - if invalid