Class UuidValidator


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

      • isValid

        public 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 hyphen)
         12345678ABCDABCDABCD123456789ABCD       (32 hexadecimal chars, UPPER CASE and without hyphen)
         12345678-abcd-abcd-abcd-123456789abcd   (36 hexadecimal chars, lower case and with hyphen)
         12345678-ABCD-ABCD-ABCD-123456789ABCD   (36 hexadecimal chars, UPPER CASE and with hyphen)
         
        Parameters:
        uuid - a UUID string
        Returns:
        true if valid, false if invalid
      • isValid

        public static boolean isValid​(char[] chars)
        Checks if the UUID string is valid.
         Examples of accepted formats:
         
         12345678abcdabcdabcd123456789abcd       (32 hexadecimal chars, lower case and without hyphen)
         12345678ABCDABCDABCD123456789ABCD       (32 hexadecimal chars, UPPER CASE and without hyphen)
         12345678-abcd-abcd-abcd-123456789abcd   (36 hexadecimal chars, lower case and with hyphen)
         12345678-ABCD-ABCD-ABCD-123456789ABCD   (36 hexadecimal chars, UPPER CASE and with hyphen)
         
        Parameters:
        chars - a UUID char array
        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 string
        Throws:
        InvalidUuidException - if invalid
      • validate

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