java.lang.Object
org.gcube.informationsystem.resourceregistry.utils.UUIDValidator

public class UUIDValidator extends Object
Utility class for validating caller-supplied UUID strings (path parameters, query parameters, request body fields) at the point they enter the system.
Author:
Luca Frosini (ISTI - CNR)
  • Method Details

    • validateUUID

      public static UUID validateUUID(String uuid) throws org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidUUIDException
      Validates and parses uuid, wrapping a malformed value into an InvalidUUIDException (mapped to 400 Bad Request) instead of letting IllegalArgumentException escape uncaught as an unmapped 500.
      Parameters:
      uuid - the string to validate
      Returns:
      the parsed UUID
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidUUIDException - if uuid is not a valid UUID