Package org.kiwiproject.base
Class UUIDs
- java.lang.Object
-
- org.kiwiproject.base.UUIDs
-
-
Constructor Summary
Constructors Constructor Description UUIDs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisValidUUID(String value)Checks if thevalueis a valid UUID confirming to RFC 4122.static StringrandomUUIDString()Creates a new type 4 (pseudo randomly generated) UUID, and then returns it as a string.
-
-
-
Method Detail
-
randomUUIDString
public static String randomUUIDString()
Creates a new type 4 (pseudo randomly generated) UUID, and then returns it as a string.- Returns:
- a new random UUID as a String
- See Also:
UUID.randomUUID()
-
isValidUUID
public static boolean isValidUUID(String value)
Checks if thevalueis a valid UUID confirming to RFC 4122. The general form is 8-4-4-4-12 where all the digits are hexadecimal. Example:e94c302e-e684-4d72-9060-a66461f858d6This method has been tested with UUIDs generated using
UUID.randomUUID()andUUID.nameUUIDFromBytes(byte[]). It has also been tested with UUIDs created using the constructorUUID(long, long)with the caveat that the most and least significant bits came from valid type 3 and 4 UUIDs.- Parameters:
value- the string to check- Returns:
trueif a valid UUID,falseotherwise- See Also:
UUID
-
-