@Documented @Repeatable(value: RandomUuidFormatConstraintList) @Target(value: [FIELD, METHOD, PARAMETER, TYPE_USE, ANNOTATION_TYPE]) @Retention(value: RUNTIME) @jakarta.validation.Constraint(validatedBy: []) @interface RandomUuidFormatConstraint
The annotated element must be well-formed random UUID string.
The version of random UUID string is 4, and the variant is 2. In the following UUID string representation, character M must have a value of 4 (version), while character N must have a value between 8 and B (variant):4dd180d4-c554-4235-85be-3dfed42c316d | | xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxxFor more detailed explanation, please take a look at https://www.uuidtools.com/decode This constraint accepts only
String
types.
In default validator implementation, default message interpolation keys (when message
annotation param is empty) are
org.klokwrk.lib.lo.validation.constraint.RandomUuidFormatConstraint.invalidRandomUuidFormatMessage
and
org.klokwrk.lib.lo.validation.constraint.RandomUuidFormatConstraint.invalidUuidFormatMessage
. Default implementation uses
org.klokwrk.lib.lo.validation.constraint.RandomUuidFormatConstraint.invalidUuidFormatMessage
when corresponding string cannot be parsed into a UUID. Similarly, default implementation uses
org.klokwrk.lib.lo.validation.constraint.RandomUuidFormatConstraint.invalidRandomUuidFormatMessage
when corresponding string does represent an UUID but is not a random UUID (version 4 and
variant 2).
When custom annotation message
parameter value is specified, it can be either a reference to the resource bundle key (must be enclosed in curly braces '{}
'), or a hardcoded
message. In resource bundle and in the hardcoded message, interpolation expressions must be enclosed in curly braces starting with a dollar sign '${}
'.
Type | Name and Description |
---|---|
static String |
INVALID_RANDOM_UUID_FORMAT_MESSAGE_KEY |
static String |
INVALID_UUID_FORMAT_MESSAGE_KEY |