Class UUIDUtility
java.lang.Object
org.gcube.informationsystem.utils.UUIDUtility
A utility class for handling UUIDs.
- Author:
- Luca Frosini (ISTI - CNR)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UUIDfromString(String uuidString) Converts a string to a UUID and validates it.static UUIDGets the UUID from a JSON string.static UUIDgetUUID(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) Gets the UUID from aJsonNode.static StringgetUUIDAsString(String json) Gets the UUID as a string from a JSON string.static StringgetUUIDAsString(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) Gets the UUID as a string from aJsonNode.
-
Constructor Details
-
UUIDUtility
public UUIDUtility()
-
-
Method Details
-
getUUID
Gets the UUID from aJsonNode.- Parameters:
jsonNode- The JSON node.- Returns:
- The UUID, or
nullif not found.
-
getUUID
public static UUID getUUID(String json) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException, IOException Gets the UUID from a JSON string.- Parameters:
json- The JSON string.- Returns:
- The UUID.
- Throws:
IOException- if an I/O error occurs.org.gcube.com.fasterxml.jackson.core.JsonProcessingException- if a JSON processing error occurs.
-
getUUIDAsString
Gets the UUID as a string from aJsonNode.- Parameters:
jsonNode- The JSON node.- Returns:
- The UUID as a string, or
nullif not found.
-
getUUIDAsString
public static String getUUIDAsString(String json) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException, IOException Gets the UUID as a string from a JSON string.- Parameters:
json- The JSON string.- Returns:
- The UUID as a string.
- Throws:
IOException- if an I/O error occurs.org.gcube.com.fasterxml.jackson.core.JsonProcessingException- if a JSON processing error occurs.
-
fromString
Converts a string to a UUID and validates it.- Parameters:
uuidString- The UUID string.- Returns:
- The validated UUID.
- Throws:
Exception- if the UUID is reserved.
-