Class UUIDManager
java.lang.Object
org.gcube.informationsystem.utils.UUIDManager
Manages reserved UUIDs and provides validation and generation of valid UUIDs.
- Author:
- Luca Frosini (ISTI - CNR)
-
Method Summary
Modifier and TypeMethodDescriptionGenerates a valid (non-reserved) UUID.generateValidUUID(UUID uuid) Generates a valid (non-reserved) UUID, optionally starting from a given UUID.Returns a set of all reserved UUIDs.Returns a set of all reserved UUIDs as strings.static UUIDManagerReturns the singleton instance of the UUIDManager.booleanisReservedUUID(String uuid) Checks if a UUID string is reserved.booleanisReservedUUID(UUID uuid) Checks if a UUID is reserved.validateUUID(UUID uuid) Validates a UUID, throwing an exception if it is reserved.
-
Method Details
-
getInstance
Returns the singleton instance of the UUIDManager.- Returns:
- The UUIDManager instance.
-
isReservedUUID
Checks if a UUID is reserved.- Parameters:
uuid- The UUID to check.- Returns:
trueif the UUID is reserved,falseotherwise.
-
isReservedUUID
Checks if a UUID string is reserved.- Parameters:
uuid- The UUID string to check.- Returns:
trueif the UUID is reserved,falseotherwise.
-
getAllReservedUUIDAsStrings
Returns a set of all reserved UUIDs as strings.- Returns:
- A set of reserved UUID strings.
-
getAllReservedUUID
Returns a set of all reserved UUIDs.- Returns:
- A set of reserved UUIDs.
-
generateValidUUID
Generates a valid (non-reserved) UUID.- Returns:
- A new valid UUID.
-
generateValidUUID
Generates a valid (non-reserved) UUID, optionally starting from a given UUID.- Parameters:
uuid- The UUID to start with, ornullto generate a new random UUID.- Returns:
- A valid UUID.
-
validateUUID
Validates a UUID, throwing an exception if it is reserved.- Parameters:
uuid- The UUID to validate.- Returns:
- The validated UUID.
- Throws:
Exception- if the UUID is reserved.
-