Class UUIDUtility


  • public class UUIDUtility
    extends Object
    A utility class for handling UUIDs.
    Author:
    Luca Frosini (ISTI - CNR)
    • Constructor Detail

      • UUIDUtility

        public UUIDUtility()
    • Method Detail

      • getUUID

        public static UUID getUUID​(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode)
        Gets the UUID from a JsonNode.
        Parameters:
        jsonNode - The JSON node.
        Returns:
        The UUID, or null if 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

        public static String getUUIDAsString​(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode)
        Gets the UUID as a string from a JsonNode.
        Parameters:
        jsonNode - The JSON node.
        Returns:
        The UUID as a string, or null if 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

        public static UUID fromString​(String uuidString)
                               throws Exception
        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.