
com.dominodatalab.pub.model.GetAIGatewayAuditData400Response Maven / Gradle / Ivy
/*
* Domino Public API
* Domino Public API Endpoints
*
* The version of the OpenAPI document: 0.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.dominodatalab.pub.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.dominodatalab.pub.model.FailureEnvelopeV1;
import com.dominodatalab.pub.model.InvalidBodyEnvelopeV1;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import com.dominodatalab.pub.invoker.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-04T16:37:28.765500600-04:00[America/New_York]", comments = "Generator version: 7.8.0")
@JsonDeserialize(using = GetAIGatewayAuditData400Response.GetAIGatewayAuditData400ResponseDeserializer.class)
@JsonSerialize(using = GetAIGatewayAuditData400Response.GetAIGatewayAuditData400ResponseSerializer.class)
public class GetAIGatewayAuditData400Response extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(GetAIGatewayAuditData400Response.class.getName());
public static class GetAIGatewayAuditData400ResponseSerializer extends StdSerializer {
public GetAIGatewayAuditData400ResponseSerializer(Class t) {
super(t);
}
public GetAIGatewayAuditData400ResponseSerializer() {
this(null);
}
@Override
public void serialize(GetAIGatewayAuditData400Response value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class GetAIGatewayAuditData400ResponseDeserializer extends StdDeserializer {
public GetAIGatewayAuditData400ResponseDeserializer() {
this(GetAIGatewayAuditData400Response.class);
}
public GetAIGatewayAuditData400ResponseDeserializer(Class> vc) {
super(vc);
}
@Override
public GetAIGatewayAuditData400Response deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize FailureEnvelopeV1
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (FailureEnvelopeV1.class.equals(Integer.class) || FailureEnvelopeV1.class.equals(Long.class) || FailureEnvelopeV1.class.equals(Float.class) || FailureEnvelopeV1.class.equals(Double.class) || FailureEnvelopeV1.class.equals(Boolean.class) || FailureEnvelopeV1.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((FailureEnvelopeV1.class.equals(Integer.class) || FailureEnvelopeV1.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((FailureEnvelopeV1.class.equals(Float.class) || FailureEnvelopeV1.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (FailureEnvelopeV1.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (FailureEnvelopeV1.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(FailureEnvelopeV1.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'FailureEnvelopeV1'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'FailureEnvelopeV1'", e);
}
// deserialize InvalidBodyEnvelopeV1
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (InvalidBodyEnvelopeV1.class.equals(Integer.class) || InvalidBodyEnvelopeV1.class.equals(Long.class) || InvalidBodyEnvelopeV1.class.equals(Float.class) || InvalidBodyEnvelopeV1.class.equals(Double.class) || InvalidBodyEnvelopeV1.class.equals(Boolean.class) || InvalidBodyEnvelopeV1.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((InvalidBodyEnvelopeV1.class.equals(Integer.class) || InvalidBodyEnvelopeV1.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((InvalidBodyEnvelopeV1.class.equals(Float.class) || InvalidBodyEnvelopeV1.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (InvalidBodyEnvelopeV1.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (InvalidBodyEnvelopeV1.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(InvalidBodyEnvelopeV1.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'InvalidBodyEnvelopeV1'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'InvalidBodyEnvelopeV1'", e);
}
if (match == 1) {
GetAIGatewayAuditData400Response ret = new GetAIGatewayAuditData400Response();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for GetAIGatewayAuditData400Response: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public GetAIGatewayAuditData400Response getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "GetAIGatewayAuditData400Response cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map> schemas = new HashMap<>();
public GetAIGatewayAuditData400Response() {
super("oneOf", Boolean.FALSE);
}
public GetAIGatewayAuditData400Response(FailureEnvelopeV1 o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public GetAIGatewayAuditData400Response(InvalidBodyEnvelopeV1 o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("FailureEnvelopeV1", FailureEnvelopeV1.class);
schemas.put("InvalidBodyEnvelopeV1", InvalidBodyEnvelopeV1.class);
JSON.registerDescendants(GetAIGatewayAuditData400Response.class, Collections.unmodifiableMap(schemas));
}
@Override
public Map> getSchemas() {
return GetAIGatewayAuditData400Response.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* FailureEnvelopeV1, InvalidBodyEnvelopeV1
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(FailureEnvelopeV1.class, instance, new HashSet>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(InvalidBodyEnvelopeV1.class, instance, new HashSet>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be FailureEnvelopeV1, InvalidBodyEnvelopeV1");
}
/**
* Get the actual instance, which can be the following:
* FailureEnvelopeV1, InvalidBodyEnvelopeV1
*
* @return The actual instance (FailureEnvelopeV1, InvalidBodyEnvelopeV1)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `FailureEnvelopeV1`. If the actual instance is not `FailureEnvelopeV1`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `FailureEnvelopeV1`
* @throws ClassCastException if the instance is not `FailureEnvelopeV1`
*/
public FailureEnvelopeV1 getFailureEnvelopeV1() throws ClassCastException {
return (FailureEnvelopeV1)super.getActualInstance();
}
/**
* Get the actual instance of `InvalidBodyEnvelopeV1`. If the actual instance is not `InvalidBodyEnvelopeV1`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `InvalidBodyEnvelopeV1`
* @throws ClassCastException if the instance is not `InvalidBodyEnvelopeV1`
*/
public InvalidBodyEnvelopeV1 getInvalidBodyEnvelopeV1() throws ClassCastException {
return (InvalidBodyEnvelopeV1)super.getActualInstance();
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
if (getActualInstance() instanceof FailureEnvelopeV1) {
if (getActualInstance() != null) {
joiner.add(((FailureEnvelopeV1)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof InvalidBodyEnvelopeV1) {
if (getActualInstance() != null) {
joiner.add(((InvalidBodyEnvelopeV1)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy