com.clinia.model.datacatalog.V1FileProtocol 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;
/** V1FileProtocol */
@JsonDeserialize(using = V1FileProtocol.Deserializer.class)
public interface V1FileProtocol {
class Deserializer extends JsonDeserializer {
private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName());
@Override
public V1FileProtocol deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonNode tree = jp.readValueAsTree();
// deserialize V1SFTPProtocol
if (tree.isObject()) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(V1SFTPProtocol.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf V1SFTPProtocol (error: " + e.getMessage() + ") (type: V1SFTPProtocol)");
}
}
throw new CliniaRuntimeException(String.format("Failed to deserialize json element: %s", tree));
}
/** Handle deserialization of the 'null' value. */
@Override
public V1FileProtocol getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "V1FileProtocol cannot be null");
}
}
}