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

com.clinia.model.datacatalog.V1DataPartitionSourceConfig Maven / Gradle / Ivy

// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/clinia/api-clients-generation. DO NOT EDIT.

package com.clinia.model.datacatalog;

import com.clinia.exceptions.CliniaRuntimeException;
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;

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

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

    @Override
    public V1DataPartitionSourceConfig deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
      JsonNode tree = jp.readValueAsTree();
      // deserialize V1MDMPartitionConfig
      if (tree.isObject()) {
        try (JsonParser parser = tree.traverse(jp.getCodec())) {
          return parser.readValueAs(V1MDMPartitionConfig.class);
        } catch (Exception e) {
          // deserialization failed, continue
          LOGGER.finest("Failed to deserialize oneOf V1MDMPartitionConfig (error: " + e.getMessage() + ") (type: V1MDMPartitionConfig)");
        }
      }
      // deserialize V1DataSourcePartitionConfig
      if (tree.isObject()) {
        try (JsonParser parser = tree.traverse(jp.getCodec())) {
          return parser.readValueAs(V1DataSourcePartitionConfig.class);
        } catch (Exception e) {
          // deserialization failed, continue
          LOGGER.finest(
            "Failed to deserialize oneOf V1DataSourcePartitionConfig (error: " + e.getMessage() + ") (type: V1DataSourcePartitionConfig)"
          );
        }
      }
      throw new CliniaRuntimeException(String.format("Failed to deserialize json element: %s", tree));
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy