UUID
global class UUID
Description
Represents a UUID/GUID.
Methods
parse
Description
Parses a string as a UUID. Throws a
StringException if the input string is blank or does not match the UUID pattern.Returns
The parsed UUID, assuming the input string is valid.
Parameters
sfinal String s
The input string matching the pattern
[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}. randomUUID
global static UUID randomUUID()
Description
Generates a cryptographically-random UUID. Useful for generating secrets or unit testing methods requiring a UUID argument.
Returns
The generated UUID.
tryParse
Description
Attempts to parse a string as a UUID.
Returns
The parsed UUID if the input string is valid, or
null if the input string is invalid.Parameters
sfinal String s
The input string matching the pattern
[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}.