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