Package org.keycloak.models.map.common
Class UuidValidator
- java.lang.Object
-
- org.keycloak.models.map.common.UuidValidator
-
public class UuidValidator extends Object
Utility class for validating and converting UUIDs.- Author:
- Stefan Guilhen
-
-
Field Summary
Fields Modifier and Type Field Description protected static PatternUUID_REGEX_PATTERN
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisValid(String id)Validates that the specifiedidis aUUID.static StringvalidateAndConvert(String id)Validates that the specifiedidis aUUID.
-
-
-
Field Detail
-
UUID_REGEX_PATTERN
protected static final Pattern UUID_REGEX_PATTERN
-
-
Method Detail
-
isValid
public static boolean isValid(String id)
Validates that the specifiedidis aUUID.- Parameters:
id- theidto be validated.- Returns:
trueif theidis aUUID;falseotherwise.
-
validateAndConvert
public static String validateAndConvert(String id)
Validates that the specifiedidis aUUID. If it is, theiditself is returned. Otherwise, it is discarded and a newUUIDis created and returned.- Parameters:
id- theidto be validated.- Returns:
- the
iditself if it is a validUUID, or a new generatedUUID.
-
-