public FunctionSignature deserialize()

in zetasql-toolkit-core/src/main/java/com/google/zetasql/toolkit/catalog/io/JsonCatalogDeserializer.java [298:330]


    public FunctionSignature deserialize(
        JsonElement jsonElement, java.lang.reflect.Type type, JsonDeserializationContext context)
        throws JsonParseException {
      JsonObject jsonObject =
          getAsJsonObject(
              jsonElement,
              "Invalid JSON function signature: " + jsonElement + ". Should be object.");

      String returnType =
          getFieldAsString(
              jsonObject,
              "returnType",
              "Invalid JSON function signature: "
                  + jsonElement
                  + ". Field returnType should be string.");

      Type parsedReturnType = parseType(returnType);

      FunctionArgumentType[] arguments =
          Optional.ofNullable(jsonObject.get("arguments"))
              .map(
                  jsonArguments -> context.deserialize(jsonArguments, FunctionArgumentType[].class))
              .map(FunctionArgumentType[].class::cast)
              .orElseThrow(
                  () ->
                      new JsonParseException(
                          "Invalid JSON function signature: "
                              + jsonElement
                              + ". Arguments missing."));

      return new FunctionSignature(
          new FunctionArgumentType(parsedReturnType), Arrays.asList(arguments), -1);
    }