All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.algolia.model.ingestion.SourceUpdateInput Maven / Gradle / Ivy

The newest version!
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

package com.algolia.model.ingestion;

import com.algolia.exceptions.AlgoliaRuntimeException;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.*;
import java.io.IOException;
import java.util.logging.Logger;

/** SourceUpdateInput */
@JsonDeserialize(using = SourceUpdateInput.Deserializer.class)
public interface SourceUpdateInput {
  class Deserializer extends JsonDeserializer {

    private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName());

    @Override
    public SourceUpdateInput deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
      JsonNode tree = jp.readValueAsTree();
      // deserialize SourceGA4BigQueryExport
      if (tree.isObject() && tree.has("projectID") && tree.has("datasetID") && tree.has("tablePrefix")) {
        try (JsonParser parser = tree.traverse(jp.getCodec())) {
          return parser.readValueAs(SourceGA4BigQueryExport.class);
        } catch (Exception e) {
          // deserialization failed, continue
          LOGGER.finest(
            "Failed to deserialize oneOf SourceGA4BigQueryExport (error: " + e.getMessage() + ") (type: SourceGA4BigQueryExport)"
          );
        }
      }
      // deserialize SourceBigQuery
      if (tree.isObject() && tree.has("projectID")) {
        try (JsonParser parser = tree.traverse(jp.getCodec())) {
          return parser.readValueAs(SourceBigQuery.class);
        } catch (Exception e) {
          // deserialization failed, continue
          LOGGER.finest("Failed to deserialize oneOf SourceBigQuery (error: " + e.getMessage() + ") (type: SourceBigQuery)");
        }
      }
      // deserialize SourceUpdateDocker
      if (tree.isObject() && tree.has("configuration")) {
        try (JsonParser parser = tree.traverse(jp.getCodec())) {
          return parser.readValueAs(SourceUpdateDocker.class);
        } catch (Exception e) {
          // deserialization failed, continue
          LOGGER.finest("Failed to deserialize oneOf SourceUpdateDocker (error: " + e.getMessage() + ") (type: SourceUpdateDocker)");
        }
      }
      // deserialize SourceUpdateCommercetools
      if (tree.isObject()) {
        try (JsonParser parser = tree.traverse(jp.getCodec())) {
          return parser.readValueAs(SourceUpdateCommercetools.class);
        } catch (Exception e) {
          // deserialization failed, continue
          LOGGER.finest(
            "Failed to deserialize oneOf SourceUpdateCommercetools (error: " + e.getMessage() + ") (type: SourceUpdateCommercetools)"
          );
        }
      }
      // deserialize SourceJSON
      if (tree.isObject()) {
        try (JsonParser parser = tree.traverse(jp.getCodec())) {
          return parser.readValueAs(SourceJSON.class);
        } catch (Exception e) {
          // deserialization failed, continue
          LOGGER.finest("Failed to deserialize oneOf SourceJSON (error: " + e.getMessage() + ") (type: SourceJSON)");
        }
      }
      // deserialize SourceCSV
      if (tree.isObject()) {
        try (JsonParser parser = tree.traverse(jp.getCodec())) {
          return parser.readValueAs(SourceCSV.class);
        } catch (Exception e) {
          // deserialization failed, continue
          LOGGER.finest("Failed to deserialize oneOf SourceCSV (error: " + e.getMessage() + ") (type: SourceCSV)");
        }
      }
      // deserialize SourceUpdateShopify
      if (tree.isObject()) {
        try (JsonParser parser = tree.traverse(jp.getCodec())) {
          return parser.readValueAs(SourceUpdateShopify.class);
        } catch (Exception e) {
          // deserialization failed, continue
          LOGGER.finest("Failed to deserialize oneOf SourceUpdateShopify (error: " + e.getMessage() + ") (type: SourceUpdateShopify)");
        }
      }
      throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree));
    }

    /** Handle deserialization of the 'null' value. */
    @Override
    public SourceUpdateInput getNullValue(DeserializationContext ctxt) throws JsonMappingException {
      throw new JsonMappingException(ctxt.getParser(), "SourceUpdateInput cannot be null");
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy