Class UUIDValidator
java.lang.Object
org.gcube.informationsystem.resourceregistry.utils.UUIDValidator
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 Summary
Modifier and TypeMethodDescriptionstatic UUIDvalidateUUID(String uuid) Validates and parsesuuid, wrapping a malformed value into anInvalidUUIDException(mapped to400 Bad Request) instead of lettingIllegalArgumentExceptionescape uncaught as an unmapped500.
-
Method Details
-
validateUUID
public static UUID validateUUID(String uuid) throws org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidUUIDException Validates and parsesuuid, wrapping a malformed value into anInvalidUUIDException(mapped to400 Bad Request) instead of lettingIllegalArgumentExceptionescape uncaught as an unmapped500.- Parameters:
uuid- the string to validate- Returns:
- the parsed
UUID - Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidUUIDException- ifuuidis not a valid UUID
-