Class UUIDManager
- java.lang.Object
-
- org.gcube.informationsystem.utils.UUIDManager
-
public final class UUIDManager extends Object
Manages reserved UUIDs and provides validation and generation of valid UUIDs.- Author:
- Luca Frosini (ISTI - CNR)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UUIDgenerateValidUUID()Generates a valid (non-reserved) UUID.UUIDgenerateValidUUID(UUID uuid)Generates a valid (non-reserved) UUID, optionally starting from a given UUID.Set<UUID>getAllReservedUUID()Returns a set of all reserved UUIDs.Set<String>getAllReservedUUIDAsStrings()Returns a set of all reserved UUIDs as strings.static UUIDManagergetInstance()Returns 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.UUIDvalidateUUID(UUID uuid)Validates a UUID, throwing an exception if it is reserved.
-
-
-
Method Detail
-
getInstance
public static UUIDManager getInstance()
Returns the singleton instance of the UUIDManager.- Returns:
- The UUIDManager instance.
-
isReservedUUID
public boolean isReservedUUID(UUID uuid)
Checks if a UUID is reserved.- Parameters:
uuid- The UUID to check.- Returns:
trueif the UUID is reserved,falseotherwise.
-
isReservedUUID
public boolean isReservedUUID(String uuid)
Checks if a UUID string is reserved.- Parameters:
uuid- The UUID string to check.- Returns:
trueif the UUID is reserved,falseotherwise.
-
getAllReservedUUIDAsStrings
public Set<String> getAllReservedUUIDAsStrings()
Returns a set of all reserved UUIDs as strings.- Returns:
- A set of reserved UUID strings.
-
getAllReservedUUID
public Set<UUID> getAllReservedUUID()
Returns a set of all reserved UUIDs.- Returns:
- A set of reserved UUIDs.
-
generateValidUUID
public UUID generateValidUUID()
Generates a valid (non-reserved) UUID.- Returns:
- A new valid UUID.
-
generateValidUUID
public UUID generateValidUUID(UUID uuid)
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.
-
-