Annotation Type UUID


Checks that the annotated character sequence is a valid UUID.

Validation characteristics:

  • Consists only of numbers, hex characters and dashes
  • Has exact length of 36 characters
  • Number of hex digits in every group (8-4-4-4-12)
  • Nil UUID (default: allowed)
  • Allowed UUID versions (default: 1 to 5)
  • Allowed UUID variants (default: 0 to 2)
  • Letter case (default: lower case)

The supported type is CharSequence. null is considered valid.

Since:
8.0.0
Author:
Daniel Heid
  • Element Details

    • message

      String message
      Default:
      "{org.hibernate.validator.constraints.UUID.message}"
    • groups

      Class<?>[] groups
      Default:
      {}
    • payload

      Class<? extends Payload>[] payload
      Default:
      {}
    • allowEmpty

      boolean allowEmpty
      Returns:
      allow empty strings. Per default does not allow empty strings
      Default:
      false
    • allowNil

      boolean allowNil
      Returns:
      true if nil UUIDs 00000000-0000-0000-0000-000000000000 are valid Per default nil UUIDs are valid
      Default:
      true
    • version

      int[] version
      Must not be lower than version 1
      Returns:
      the accepted UUID version numbers Per default versions 1 to 5 are allowed
      Default:
      {1, 2, 3, 4, 5}
    • variant

      int[] variant
      Must not be lower than variant 0
      Returns:
      the allowed UUID variant numbers Per default variants 0 to 2 are allowed
      Default:
      {0, 1, 2}
    • letterCase

      UUID.LetterCase letterCase
      Returns:
      the required letter case Per default only lower case is valid
      See Also:
      Default:
      LOWER_CASE